Commit 99453027 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Merge branch 'comments-fixture' into 'master'

Replace static fixture for notes_spec

## What does this MR do?

Replace `comments.html.haml` and `issue_note.html.haml` used in `notes_spec.js` by dynamically created fixture.

## What are the relevant issue numbers?

#24753

See merge request !7683
parents c825ca74 c4244ba4
---
title: Replace static fixture for notes_spec
merge_request: 7683
author: winniehell
.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
%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
...@@ -26,8 +26,13 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller ...@@ -26,8 +26,13 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller
end end
it 'issues/issue-with-task-list.html.raw' do |example| 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 = 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) render_issue(example.description, issue)
end end
......
...@@ -6,17 +6,21 @@ ...@@ -6,17 +6,21 @@
(function() { (function() {
window.gon || (window.gon = {}); window.gon || (window.gon = {});
window.gl = window.gl || {};
window.disableButtonIfEmptyField = function() { gl.utils = gl.utils || {};
return null;
};
describe('Notes', function() { describe('Notes', function() {
describe('task lists', function() { var commentsTemplate = 'issues/issue_with_comment.raw';
fixture.preload('issue_note.html'); 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() { beforeEach(function() {
fixture.load('issue_note.html');
$('form').on('submit', function(e) { $('form').on('submit', function(e) {
e.preventDefault(); e.preventDefault();
}); });
...@@ -41,12 +45,9 @@ ...@@ -41,12 +45,9 @@
}); });
describe('comments', function() { describe('comments', function() {
var commentsTemplate = 'comments.html';
var textarea = '.js-note-text'; var textarea = '.js-note-text';
fixture.preload(commentsTemplate);
beforeEach(function() { beforeEach(function() {
fixture.load(commentsTemplate);
this.notes = new Notes(); this.notes = new Notes();
this.autoSizeSpy = spyOnEvent($(textarea), 'autosize:update'); this.autoSizeSpy = spyOnEvent($(textarea), 'autosize:update');
......
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