diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-05-06 16:54:34 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-05-28 18:22:32 -0400 |
commit | c9788bd9d8f6e7b7ae445b61b06877411ee01c9e (patch) | |
tree | 5eb3ca9b39e3e425cd821b307178107f86c10b4f /spec/javascripts | |
parent | 73440b0364dbb49a64a49644e2b5487d203d88cc (diff) | |
download | gitlab-ce-c9788bd9d8f6e7b7ae445b61b06877411ee01c9e.tar.gz |
Remove jasmine-fixture, use teaspoon fixtures
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/fixtures/issuable.html.haml | 2 | ||||
-rw-r--r-- | spec/javascripts/fixtures/issue_note.html.haml | 12 | ||||
-rw-r--r-- | spec/javascripts/fixtures/issues_show.html.haml | 13 | ||||
-rw-r--r-- | spec/javascripts/fixtures/merge_requests_show.html.haml | 13 | ||||
-rw-r--r-- | spec/javascripts/issue_spec.js.coffee | 27 | ||||
-rw-r--r-- | spec/javascripts/merge_request_spec.js.coffee | 29 | ||||
-rw-r--r-- | spec/javascripts/notes_spec.js.coffee | 19 | ||||
-rw-r--r-- | spec/javascripts/shortcuts_issuable_spec.js.coffee | 7 |
8 files changed, 64 insertions, 58 deletions
diff --git a/spec/javascripts/fixtures/issuable.html.haml b/spec/javascripts/fixtures/issuable.html.haml new file mode 100644 index 00000000000..42ab4aa68b1 --- /dev/null +++ b/spec/javascripts/fixtures/issuable.html.haml @@ -0,0 +1,2 @@ +%form.js-main-target-form + %textarea#note_note diff --git a/spec/javascripts/fixtures/issue_note.html.haml b/spec/javascripts/fixtures/issue_note.html.haml new file mode 100644 index 00000000000..0aecc7334fd --- /dev/null +++ b/spec/javascripts/fixtures/issue_note.html.haml @@ -0,0 +1,12 @@ +%ul + %li.note + .js-task-list-container + .note-text + %ul.task-list + %li.task-list-item + %input.task-list-item-checkbox{type: 'checkbox'} + Task List Item + .note-edit-form + %form + %textarea.js-task-list-field + \- [ ] Task List Item diff --git a/spec/javascripts/fixtures/issues_show.html.haml b/spec/javascripts/fixtures/issues_show.html.haml new file mode 100644 index 00000000000..db5abe0cae3 --- /dev/null +++ b/spec/javascripts/fixtures/issues_show.html.haml @@ -0,0 +1,13 @@ +%a.btn-close + +.issue-details + .description.js-task-list-container + .wiki + %ul.task-list + %li.task-list-item + %input.task-list-item-checkbox{type: 'checkbox'} + Task List Item + %textarea.js-task-list-field + \- [ ] Task List Item + +%form.js-issue-update{action: '/foo'} diff --git a/spec/javascripts/fixtures/merge_requests_show.html.haml b/spec/javascripts/fixtures/merge_requests_show.html.haml new file mode 100644 index 00000000000..c4329b8f94a --- /dev/null +++ b/spec/javascripts/fixtures/merge_requests_show.html.haml @@ -0,0 +1,13 @@ +%a.btn-close + +.merge-request-details + .description.js-task-list-container + .wiki + %ul.task-list + %li.task-list-item + %input.task-list-item-checkbox{type: 'checkbox'} + Task List Item + %textarea.js-task-list-field + \- [ ] Task List Item + +%form.js-merge-request-update{action: '/foo'} diff --git a/spec/javascripts/issue_spec.js.coffee b/spec/javascripts/issue_spec.js.coffee index 13b25862f57..abe0754b65a 100644 --- a/spec/javascripts/issue_spec.js.coffee +++ b/spec/javascripts/issue_spec.js.coffee @@ -1,32 +1,17 @@ -#= require jquery -#= require jasmine-fixture #= require issue describe 'Issue', -> describe 'task lists', -> - selectors = { - container: '.issue-details .description.js-task-list-container' - item: '.wiki ul.task-list li.task-list-item input.task-list-item-checkbox[type=checkbox] {Task List Item}' - textarea: '.wiki textarea.js-task-list-field{- [ ] Task List Item}' - form: 'form.js-issue-update[action="/foo"]' - close: 'a.btn-close' - } + fixture.preload('issues_show.html') beforeEach -> - $container = affix(selectors.container) - - # # These two elements are siblings inside the container - $container.find('.js-task-list-container').append(affix(selectors.item)) - $container.find('.js-task-list-container').append(affix(selectors.textarea)) - - # Task lists don't get initialized unless this button exists. Not ideal. - $container.append(affix(selectors.close)) - - # This form is used to get the `update` URL. Not ideal. - $container.append(affix(selectors.form)) - + fixture.load('issues_show.html') @issue = new Issue() + it 'modifies the Markdown field', -> + $('input[type=checkbox]').attr('checked', true).trigger('change') + expect($('.js-task-list-field').val()).toBe('- [x] Task List Item') + it 'submits an ajax request on tasklist:changed', -> spyOn($, 'ajax').and.callFake (req) -> expect(req.type).toBe('PATCH') diff --git a/spec/javascripts/merge_request_spec.js.coffee b/spec/javascripts/merge_request_spec.js.coffee index 3ebc4a4eed5..8b8f77c56cf 100644 --- a/spec/javascripts/merge_request_spec.js.coffee +++ b/spec/javascripts/merge_request_spec.js.coffee @@ -1,32 +1,19 @@ -#= require jquery -#= require jasmine-fixture #= require merge_request +window.disableButtonIfEmptyField = -> null + describe 'MergeRequest', -> describe 'task lists', -> - selectors = { - container: '.merge-request-details .description.js-task-list-container' - item: '.wiki ul.task-list li.task-list-item input.task-list-item-checkbox[type=checkbox] {Task List Item}' - textarea: '.wiki textarea.js-task-list-field{- [ ] Task List Item}' - form: 'form.js-merge-request-update[action="/foo"]' - close: 'a.btn-close' - } + fixture.preload('merge_requests_show.html') beforeEach -> - $container = affix(selectors.container) - - # # These two elements are siblings inside the container - $container.find('.js-task-list-container').append(affix(selectors.item)) - $container.find('.js-task-list-container').append(affix(selectors.textarea)) - - # Task lists don't get initialized unless this button exists. Not ideal. - $container.append(affix(selectors.close)) - - # This form is used to get the `update` URL. Not ideal. - $container.append(affix(selectors.form)) - + fixture.load('merge_requests_show.html') @merge = new MergeRequest({}) + it 'modifies the Markdown field', -> + $('input[type=checkbox]').attr('checked', true).trigger('change') + expect($('.js-task-list-field').val()).toBe('- [x] Task List Item') + it 'submits an ajax request on tasklist:changed', -> spyOn($, 'ajax').and.callFake (req) -> expect(req.type).toBe('PATCH') diff --git a/spec/javascripts/notes_spec.js.coffee b/spec/javascripts/notes_spec.js.coffee index de2e8e7f6c8..050b6e362c6 100644 --- a/spec/javascripts/notes_spec.js.coffee +++ b/spec/javascripts/notes_spec.js.coffee @@ -1,5 +1,3 @@ -#= require jquery -#= require jasmine-fixture #= require notes window.gon = {} @@ -7,21 +5,18 @@ window.disableButtonIfEmptyField = -> null describe 'Notes', -> describe 'task lists', -> - selectors = { - container: 'li.note .js-task-list-container' - item: '.note-text ul.task-list li.task-list-item input.task-list-item-checkbox[type=checkbox] {Task List Item}' - textarea: '.note-edit-form form textarea.js-task-list-field{- [ ] Task List Item}' - } + fixture.preload('issue_note.html') beforeEach -> - $container = affix(selectors.container) - - # These two elements are siblings inside the container - $container.find('.js-task-list-container').append(affix(selectors.item)) - $container.find('.js-task-list-container').append(affix(selectors.textarea)) + fixture.load('issue_note.html') + $('form').on 'submit', (e) -> e.preventDefault() @notes = new Notes() + it 'modifies the Markdown field', -> + $('input[type=checkbox]').attr('checked', true).trigger('change') + expect($('.js-task-list-field').val()).toBe('- [x] Task List Item') + it 'submits the form on tasklist:changed', -> submitted = false $('form').on 'submit', (e) -> submitted = true; e.preventDefault() diff --git a/spec/javascripts/shortcuts_issuable_spec.js.coffee b/spec/javascripts/shortcuts_issuable_spec.js.coffee index 57dcc2161d3..a01ad7140dd 100644 --- a/spec/javascripts/shortcuts_issuable_spec.js.coffee +++ b/spec/javascripts/shortcuts_issuable_spec.js.coffee @@ -1,10 +1,10 @@ -#= require jquery -#= require jasmine-fixture - #= require shortcuts_issuable describe 'ShortcutsIssuable', -> + fixture.preload('issuable.html') + beforeEach -> + fixture.load('issuable.html') @shortcut = new ShortcutsIssuable() describe '#replyWithSelectedText', -> @@ -14,7 +14,6 @@ describe 'ShortcutsIssuable', -> beforeEach -> @selector = 'form.js-main-target-form textarea#note_note' - affix(@selector) describe 'with empty selection', -> it 'does nothing', -> |