Commit cfc03dab authored by Regis's avatar Regis

fix rubocop offenses

parent 7021e867
...@@ -43,7 +43,6 @@ export default { ...@@ -43,7 +43,6 @@ export default {
methods: { methods: {
renderResponse(res) { renderResponse(res) {
this.apiData = JSON.parse(res.body); this.apiData = JSON.parse(res.body);
this.issueIID = this.apiData.issue_number;
this.triggerAnimation(); this.triggerAnimation();
}, },
updateTaskHTML() { updateTaskHTML() {
...@@ -90,7 +89,7 @@ export default { ...@@ -90,7 +89,7 @@ export default {
setTabTitle() { setTabTitle() {
const currentTabTitle = document.querySelector('title'); const currentTabTitle = document.querySelector('title');
const currentTabTitleScope = currentTabTitle.innerText.split('·'); const currentTabTitleScope = currentTabTitle.innerText.split('·');
currentTabTitleScope[0] = `${this.titleText} (#${this.issueIID}) `; currentTabTitleScope[0] = `${this.titleText} (#${this.apiData.issue_number}) `;
currentTabTitle.innerText = currentTabTitleScope.join('·'); currentTabTitle.innerText = currentTabTitleScope.join('·');
}, },
animate(title, description, elementsToVisualize) { animate(title, description, elementsToVisualize) {
......
...@@ -62,15 +62,16 @@ feature 'Task Lists', feature: true do ...@@ -62,15 +62,16 @@ feature 'Task Lists', feature: true do
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
end end
describe 'for Issues' do describe 'for Issues', js: true do
include WaitForVueResource include WaitForVueResource
before { wait_for_vue_resource }
describe 'multiple tasks', js: true do 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)
...@@ -79,7 +80,6 @@ feature 'Task Lists', feature: true do ...@@ -79,7 +80,6 @@ feature 'Task Lists', feature: true do
it 'contains the required selectors' do it 'contains the required selectors' do
visit_issue(project, issue) visit_issue(project, issue)
wait_for_vue_resource
container = '.detail-page-description .description.js-task-list-container' container = '.detail-page-description .description.js-task-list-container'
...@@ -92,14 +92,12 @@ feature 'Task Lists', feature: true do ...@@ -92,14 +92,12 @@ 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,12 +107,15 @@ feature 'Task Lists', feature: true do ...@@ -109,12 +107,15 @@ feature 'Task Lists', feature: true do
end end
end end
describe 'single incomplete task' do describe 'single incomplete task', js: true do
include WaitForVueResource
let!(:issue) { create(:issue, description: singleIncompleteMarkdown, author: user, project: project) } let!(:issue) { create(:issue, description: singleIncompleteMarkdown, author: user, project: project) }
before { wait_for_vue_resource }
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)
...@@ -132,7 +133,6 @@ feature 'Task Lists', feature: true do ...@@ -132,7 +133,6 @@ 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)
...@@ -151,9 +151,6 @@ feature 'Task Lists', feature: true do ...@@ -151,9 +151,6 @@ 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)
...@@ -163,8 +160,6 @@ feature 'Task Lists', feature: true do ...@@ -163,8 +160,6 @@ 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
...@@ -173,8 +168,6 @@ feature 'Task Lists', feature: true do ...@@ -173,8 +168,6 @@ 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