diff options
author | Illya Klymov <xanf@xanf.me> | 2019-09-11 17:56:42 +0300 |
---|---|---|
committer | Illya Klymov <xanf@xanf.me> | 2019-09-11 17:56:42 +0300 |
commit | 096755c73b48b34958830d42985623cb6e14a5df (patch) | |
tree | cdbfe287eae2668e9a5854b438bded405c2ff29d | |
parent | e7efa98a761e9a8f9f4f6b822ab8821d39983d4e (diff) | |
download | gitlab-ce-ce-xanf-migrate-todo-spec-to-jest.tar.gz |
Move check to snapshotce-xanf-migrate-todo-spec-to-jest
-rw-r--r-- | spec/frontend/sidebar/__snapshots__/todo_spec.js.snap | 37 | ||||
-rw-r--r-- | spec/frontend/sidebar/todo_spec.js | 18 |
2 files changed, 39 insertions, 16 deletions
diff --git a/spec/frontend/sidebar/__snapshots__/todo_spec.js.snap b/spec/frontend/sidebar/__snapshots__/todo_spec.js.snap new file mode 100644 index 00000000000..e680c917611 --- /dev/null +++ b/spec/frontend/sidebar/__snapshots__/todo_spec.js.snap @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`SidebarTodo template renders component container element with proper data attributes 1`] = ` +<button + aria-label="Mark as done" + class="btn btn-default btn-todo issuable-header-btn float-right" + data-boundary="viewport" + data-container="body" + data-issuable-id="1" + data-issuable-type="epic" + data-original-title="" + data-placement="left" + title="" + type="button" +> + <icon-stub + cssclasses="todo-undone" + name="todo-done" + size="16" + style="display: none;" + /> + + <span + class="issuable-todo-inner" + > + Mark as done + </span> + + <glloadingicon-stub + color="orange" + inline="true" + label="Loading" + size="sm" + style="display: none;" + /> +</button> +`; diff --git a/spec/frontend/sidebar/todo_spec.js b/spec/frontend/sidebar/todo_spec.js index f5fc7407289..5f5a5257f41 100644 --- a/spec/frontend/sidebar/todo_spec.js +++ b/spec/frontend/sidebar/todo_spec.js @@ -88,27 +88,13 @@ describe('SidebarTodo', () => { expect(wrapper.emitted().toggleTodo).toBeTruthy(); }); - it('renders component container element', () => { + it('renders component container element with proper data attributes', () => { createComponent({ issuableId: 1, issuableType: 'epic', }); - const dataAttributes = { - issuableId: '1', - issuableType: 'epic', - originalTitle: '', - placement: 'left', - container: 'body', - boundary: 'viewport', - }; - - expect(wrapper.element.nodeName).toBe('BUTTON'); - - const elDataAttrs = wrapper.element.dataset; - Object.keys(elDataAttrs).forEach(attr => { - expect(elDataAttrs[attr]).toBe(dataAttributes[attr]); - }); + expect(wrapper.element).toMatchSnapshot(); }); it('check button label computed property', () => { |