summaryrefslogtreecommitdiff
path: root/spec/javascripts/notes_spec.js.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/notes_spec.js.coffee')
-rw-r--r--spec/javascripts/notes_spec.js.coffee30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/javascripts/notes_spec.js.coffee b/spec/javascripts/notes_spec.js.coffee
new file mode 100644
index 00000000000..de2e8e7f6c8
--- /dev/null
+++ b/spec/javascripts/notes_spec.js.coffee
@@ -0,0 +1,30 @@
+#= require jquery
+#= require jasmine-fixture
+#= require notes
+
+window.gon = {}
+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}'
+ }
+
+ 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))
+
+ @notes = new Notes()
+
+ it 'submits the form on tasklist:changed', ->
+ submitted = false
+ $('form').on 'submit', (e) -> submitted = true; e.preventDefault()
+
+ $('.js-task-list-field').trigger('tasklist:changed')
+ expect(submitted).toBe(true)