Commit 3417e97c authored by Regis's avatar Regis

fix a few tests (not all) - update title in tab with new issue

parent 76cdb8ee
...@@ -68,6 +68,8 @@ export default { ...@@ -68,6 +68,8 @@ export default {
this.timeoutId = setTimeout(() => { this.timeoutId = setTimeout(() => {
this.title = title; this.title = title;
document.querySelector('title').innerText = title;
this.description = description; this.description = description;
elementsToVisualize.forEach((element) => { elementsToVisualize.forEach((element) => {
...@@ -98,13 +100,15 @@ export default { ...@@ -98,13 +100,15 @@ export default {
}); });
}, },
updated() { updated() {
new gl.TaskList({ const tl = new gl.TaskList({
dataType: 'issue', dataType: 'issue',
fieldName: 'description', fieldName: 'description',
selector: '.detail-page-description', selector: '.detail-page-description',
}).init(); });
$(this.$refs['issue-content-container-gfm-entry']).renderGFM(); $(this.$refs['issue-content-container-gfm-entry']).renderGFM();
return tl;
}, },
}; };
</script> </script>
......
...@@ -63,12 +63,16 @@ feature 'Task Lists', feature: true do ...@@ -63,12 +63,16 @@ feature 'Task Lists', feature: true do
end end
describe 'for Issues' do describe 'for Issues' do
describe 'multiple tasks' do include WaitForVueResource
describe 'multiple tasks', js: true do
let!(:issue) { create(:issue, description: markdown, author: user, project: project) } let!(:issue) { create(:issue, description: markdown, author: user, project: project) }
it 'renders' do it 'renders' do
visit_issue(project, issue) visit_issue(project, issue)
wait_for_vue_resource
expect(page).to have_selector('ul.task-list', count: 1) expect(page).to have_selector('ul.task-list', count: 1)
expect(page).to have_selector('li.task-list-item', count: 6) expect(page).to have_selector('li.task-list-item', count: 6)
expect(page).to have_selector('ul input[checked]', count: 2) expect(page).to have_selector('ul input[checked]', count: 2)
...@@ -79,6 +83,8 @@ feature 'Task Lists', feature: true do ...@@ -79,6 +83,8 @@ feature 'Task Lists', feature: true do
container = '.detail-page-description .description.js-task-list-container' container = '.detail-page-description .description.js-task-list-container'
wait_for_vue_resource
expect(page).to have_selector(container) expect(page).to have_selector(container)
expect(page).to have_selector("#{container} .wiki .task-list .task-list-item .task-list-item-checkbox") expect(page).to have_selector("#{container} .wiki .task-list .task-list-item .task-list-item-checkbox")
expect(page).to have_selector("#{container} .js-task-list-field") expect(page).to have_selector("#{container} .js-task-list-field")
...@@ -88,12 +94,17 @@ feature 'Task Lists', feature: true do ...@@ -88,12 +94,17 @@ feature 'Task Lists', feature: true do
it 'is only editable by author' do it 'is only editable by author' do
visit_issue(project, issue) visit_issue(project, issue)
wait_for_vue_resource
expect(page).to have_selector('.js-task-list-container') expect(page).to have_selector('.js-task-list-container')
logout(:user) logout(:user)
login_as(user2) login_as(user2)
visit current_path visit current_path
wait_for_vue_resource
expect(page).not_to have_selector('.js-task-list-container') expect(page).not_to have_selector('.js-task-list-container')
end end
...@@ -109,6 +120,8 @@ feature 'Task Lists', feature: true do ...@@ -109,6 +120,8 @@ feature 'Task Lists', feature: true do
it 'renders' do it 'renders' do
visit_issue(project, issue) visit_issue(project, issue)
wait_for_vue_resource
expect(page).to have_selector('ul.task-list', count: 1) expect(page).to have_selector('ul.task-list', count: 1)
expect(page).to have_selector('li.task-list-item', count: 1) expect(page).to have_selector('li.task-list-item', count: 1)
expect(page).to have_selector('ul input[checked]', count: 0) expect(page).to have_selector('ul input[checked]', count: 0)
...@@ -126,6 +139,8 @@ feature 'Task Lists', feature: true do ...@@ -126,6 +139,8 @@ feature 'Task Lists', feature: true do
it 'renders' do it 'renders' do
visit_issue(project, issue) visit_issue(project, issue)
wait_for_vue_resource
expect(page).to have_selector('ul.task-list', count: 1) expect(page).to have_selector('ul.task-list', count: 1)
expect(page).to have_selector('li.task-list-item', count: 1) expect(page).to have_selector('li.task-list-item', count: 1)
expect(page).to have_selector('ul input[checked]', count: 1) expect(page).to have_selector('ul input[checked]', count: 1)
...@@ -143,6 +158,9 @@ feature 'Task Lists', feature: true do ...@@ -143,6 +158,9 @@ feature 'Task Lists', feature: true do
before { visit_issue(project, issue) } before { visit_issue(project, issue) }
it 'renders' do it 'renders' do
wait_for_vue_resource
expect(page).to have_selector('ul.task-list', count: 2) expect(page).to have_selector('ul.task-list', count: 2)
expect(page).to have_selector('li.task-list-item', count: 7) expect(page).to have_selector('li.task-list-item', count: 7)
expect(page).to have_selector('ul input[checked]', count: 1) expect(page).to have_selector('ul input[checked]', count: 1)
...@@ -152,6 +170,8 @@ feature 'Task Lists', feature: true do ...@@ -152,6 +170,8 @@ feature 'Task Lists', feature: true do
it 'solves tasks' do it 'solves tasks' do
expect(page).to have_content("2 of 7 tasks completed") expect(page).to have_content("2 of 7 tasks completed")
wait_for_vue_resource
page.find('li.task-list-item', text: 'Task b').find('input').click page.find('li.task-list-item', text: 'Task b').find('input').click
page.find('li.task-list-item ul li.task-list-item', text: 'Task a.2').find('input').click page.find('li.task-list-item ul li.task-list-item', text: 'Task a.2').find('input').click
page.find('li.task-list-item ol li.task-list-item', text: 'Task 1.1').find('input').click page.find('li.task-list-item ol li.task-list-item', text: 'Task 1.1').find('input').click
...@@ -160,6 +180,8 @@ feature 'Task Lists', feature: true do ...@@ -160,6 +180,8 @@ feature 'Task Lists', feature: true do
visit_issue(project, issue) # reload to see new system notes visit_issue(project, issue) # reload to see new system notes
wait_for_vue_resource
expect(page).to have_content('marked the task Task b as complete') expect(page).to have_content('marked the task Task b as complete')
expect(page).to have_content('marked the task Task a.2 as complete') expect(page).to have_content('marked the task Task a.2 as complete')
expect(page).to have_content('marked the task Task 1.1 as complete') expect(page).to have_content('marked the task Task 1.1 as complete')
......
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