summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwinniehell <git@winniehell.de>2016-11-22 23:46:58 +0100
committerwinniehell <git@winniehell.de>2016-12-01 15:04:07 +0100
commitc4244ba4c25e51b8d05009597e98ba8379f9cb9e (patch)
tree80d5cd902533e81ca2177b90a016767633910129
parent8146ad819e626439ac16aa473f10112ddbcf01cd (diff)
downloadgitlab-ce-c4244ba4c25e51b8d05009597e98ba8379f9cb9e.tar.gz
Replace static fixture for notes_spec (!7683)
-rw-r--r--changelogs/unreleased/comments-fixture.yml4
-rw-r--r--spec/javascripts/fixtures/comments.html.haml21
-rw-r--r--spec/javascripts/fixtures/issue_note.html.haml12
-rw-r--r--spec/javascripts/fixtures/issues.rb7
-rw-r--r--spec/javascripts/notes_spec.js21
5 files changed, 21 insertions, 44 deletions
diff --git a/changelogs/unreleased/comments-fixture.yml b/changelogs/unreleased/comments-fixture.yml
new file mode 100644
index 00000000000..824c1c88a60
--- /dev/null
+++ b/changelogs/unreleased/comments-fixture.yml
@@ -0,0 +1,4 @@
+---
+title: Replace static fixture for notes_spec
+merge_request: 7683
+author: winniehell
diff --git a/spec/javascripts/fixtures/comments.html.haml b/spec/javascripts/fixtures/comments.html.haml
deleted file mode 100644
index cc1f8f15c21..00000000000
--- a/spec/javascripts/fixtures/comments.html.haml
+++ /dev/null
@@ -1,21 +0,0 @@
-.flash-container.timeline-content
-.timeline-icon.hidden-xs.hidden-sm
- %a.author_link
- %img
-.timeline-content.timeline-content-form
- %form.new-note.js-quick-submit.common-note-form.gfm-form.js-main-target-form
- .md-area
- .md-header
- .md-write-holder
- .zen-backdrop.div-dropzone-wrapper
- .div-dropzone-wrapper
- .div-dropzone.dz-clickable
- %textarea.note-textarea.js-note-text.js-gfm-input.js-autosize.markdown-area
- .note-form-actions.clearfix
- %input.btn.btn-nr.btn-create.append-right-10.comment-btn.js-comment-button{ type: 'submit' }
- %a.btn.btn-nr.btn-reopen.btn-comment.js-note-target-reopen
- Reopen issue
- %a.btn.btn-nr.btn-close.btn-comment.js-note-target-close
- Close issue
- %a.btn.btn-cancel.js-note-discard
- Discard draft \ No newline at end of file
diff --git a/spec/javascripts/fixtures/issue_note.html.haml b/spec/javascripts/fixtures/issue_note.html.haml
deleted file mode 100644
index 0aecc7334fd..00000000000
--- a/spec/javascripts/fixtures/issue_note.html.haml
+++ /dev/null
@@ -1,12 +0,0 @@
-%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.rb b/spec/javascripts/fixtures/issues.rb
index c10784fe5ae..06f708f9e15 100644
--- a/spec/javascripts/fixtures/issues.rb
+++ b/spec/javascripts/fixtures/issues.rb
@@ -26,8 +26,13 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller
end
it 'issues/issue-with-task-list.html.raw' do |example|
+ issue = create(:issue, project: project, description: '- [ ] Task List Item')
+ render_issue(example.description, issue)
+ end
+
+ it 'issues/issue_with_comment.html.raw' do |example|
issue = create(:issue, project: project)
- issue.update(description: '- [ ] Task List Item')
+ create(:note, project: project, noteable: issue, note: '- [ ] Task List Item').save
render_issue(example.description, issue)
end
diff --git a/spec/javascripts/notes_spec.js b/spec/javascripts/notes_spec.js
index 51f2ae8bcbd..2db182d702b 100644
--- a/spec/javascripts/notes_spec.js
+++ b/spec/javascripts/notes_spec.js
@@ -6,17 +6,21 @@
(function() {
window.gon || (window.gon = {});
-
- window.disableButtonIfEmptyField = function() {
- return null;
- };
+ window.gl = window.gl || {};
+ gl.utils = gl.utils || {};
describe('Notes', function() {
- describe('task lists', function() {
- fixture.preload('issue_note.html');
+ var commentsTemplate = 'issues/issue_with_comment.raw';
+ fixture.preload(commentsTemplate);
+ beforeEach(function () {
+ fixture.load(commentsTemplate);
+ gl.utils.disableButtonIfEmptyField = _.noop;
+ window.project_uploads_path = 'http://test.host/uploads';
+ });
+
+ describe('task lists', function() {
beforeEach(function() {
- fixture.load('issue_note.html');
$('form').on('submit', function(e) {
e.preventDefault();
});
@@ -41,12 +45,9 @@
});
describe('comments', function() {
- var commentsTemplate = 'comments.html';
var textarea = '.js-note-text';
- fixture.preload(commentsTemplate);
beforeEach(function() {
- fixture.load(commentsTemplate);
this.notes = new Notes();
this.autoSizeSpy = spyOnEvent($(textarea), 'autosize:update');