Commit c9788bd9 authored by Robert Speicher's avatar Robert Speicher

Remove jasmine-fixture, use teaspoon fixtures

parent 73440b03
%form.js-main-target-form
%textarea#note_note
%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
%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'}
%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'}
#= 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')
......
#= 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')
......
#= 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()
......
#= 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', ->
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment