diff --git a/app/assets/javascripts/wikis.js.es6 b/app/assets/javascripts/wikis.js.es6 index b5626f5bd816507f3930a4519787615f502b59c8..8710ca973c4a5a01141873cdf11a8b8801ca3be1 100644 --- a/app/assets/javascripts/wikis.js.es6 +++ b/app/assets/javascripts/wikis.js.es6 @@ -17,8 +17,8 @@ $(this.sidebarEl).niceScroll(); const sidebarToggles = document.querySelectorAll('.js-sidebar-wiki-toggle'); - for (const toggle of sidebarToggles) { - toggle.addEventListener('click', e => this.handleToggleSidebar(e)); + for (let i = 0; i < sidebarToggles.length; i += 1) { + sidebarToggles[i].addEventListener('click', e => this.handleToggleSidebar(e)); } this.newWikiForm = document.querySelector('form.new-wiki-page'); diff --git a/features/project/wiki.feature b/features/project/wiki.feature index 63ce3ccb536e4bd4c4dbe4e125b9ff04eecd2df7..a04228de03b3e7f247baa4471263b34f750ecaad 100644 --- a/features/project/wiki.feature +++ b/features/project/wiki.feature @@ -49,7 +49,6 @@ Feature: Project Wiki Scenario: View all pages Given I have an existing wiki page And I browse to that Wiki page - And I click on the "Pages" button Then I should see the existing page in the pages list Scenario: File exists in wiki repo @@ -72,13 +71,11 @@ Feature: Project Wiki @javascript Scenario: New Wiki page that has a path Given I create a New page with paths - And I click on the "Pages" button Then I should see non-escaped link in the pages list @javascript Scenario: Edit Wiki page that has a path Given I create a New page with paths - And I click on the "Pages" button And I edit the Wiki page with a path Then I should see a non-escaped path And I should see the Editing page @@ -88,7 +85,6 @@ Feature: Project Wiki @javascript Scenario: View the page history of a Wiki page that has a path Given I create a New page with paths - And I click on the "Pages" button And I view the page history of a Wiki page that has a path Then I should see a non-escaped path And I should see the page history @@ -96,7 +92,6 @@ Feature: Project Wiki @javascript Scenario: View an old page version of a Wiki page Given I create a New page with paths - And I click on the "Pages" button And I edit the Wiki page with a path Then I should see a non-escaped path And I should see the Editing page diff --git a/features/steps/project/source/markdown_render.rb b/features/steps/project/source/markdown_render.rb index 2134dae168a5fc020d8d05faa9011d77a3e5d1b2..dee6a8a5558e97d4b36c787c5f27105e9b72a121 100644 --- a/features/steps/project/source/markdown_render.rb +++ b/features/steps/project/source/markdown_render.rb @@ -241,7 +241,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps page.within(:css, ".nav-text") do expect(page).to have_content "Test" - expect(page).to have_content "Edit Page" + expect(page).to have_content "Create Page" end end @@ -258,7 +258,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "api") page.within(:css, ".nav-text") do - expect(page).to have_content "Edit" + expect(page).to have_content "Create" expect(page).to have_content "Api" end end @@ -271,7 +271,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "raketasks") page.within(:css, ".nav-text") do - expect(page).to have_content "Edit" + expect(page).to have_content "Create" expect(page).to have_content "Rake" end end diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb index 07a955b1a14bb0d68867fc5c1c5710ad2ba441b1..4cb0a21fbb44a4fe03e7d55fd75d91fd61bd3bab 100644 --- a/features/steps/project/wiki.rb +++ b/features/steps/project/wiki.rb @@ -29,7 +29,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps expect(page).to have_content "link test" click_link "link test" - expect(page).to have_content "Edit Page" + expect(page).to have_content "Create Page" end step 'I have an existing Wiki page' do @@ -80,13 +80,9 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps expect(page).to have_content "Page was successfully deleted" end - step 'I click on the "Pages" button' do - click_on "Pages" - end - step 'I should see the existing page in the pages list' do expect(page).to have_content current_user.name - expect(page).to have_content @page.title + expect(find('.wiki-pages')).to have_content @page.title.capitalize end step 'I have an existing Wiki page with images linked on page' do @@ -125,7 +121,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps step 'I should see the new wiki page form' do expect(current_path).to match('wikis/image.jpg') expect(page).to have_content('New Wiki Page') - expect(page).to have_content('Edit Page') + expect(page).to have_content('Create Page') end step 'I create a New page with paths' do @@ -142,8 +138,8 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I edit the Wiki page with a path' do - expect(page).to have_content('three') - click_on 'three' + expect(find('.wiki-pages')).to have_content('Three') + click_on 'Three' expect(find('.nav-text')).to have_content('Three') click_on 'Edit' end @@ -157,7 +153,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I view the page history of a Wiki page that has a path' do - click_on 'three' + click_on 'Three' click_on 'Page History' end diff --git a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb index 7afd83b7250d6ef289466e16cd1d45fc49b5ee18..fff8b9f344756dd59c9a9152210b754666d9da88 100644 --- a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb @@ -20,7 +20,7 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do click_button 'Create page' expect(page).to have_content('Home') - expect(page).to have_content("last edited by #{user.name}") + expect(page).to have_content("Last edited by #{user.name}") expect(page).to have_content('My awesome wiki!') end end @@ -41,7 +41,7 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do click_button 'Create page' expect(page).to have_content('Foo') - expect(page).to have_content("last edited by #{user.name}") + expect(page).to have_content("Last edited by #{user.name}") expect(page).to have_content('My awesome wiki!') end @@ -55,7 +55,7 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do click_button 'Create page' expect(page).to have_content('Spaces in the name') - expect(page).to have_content("last edited by #{user.name}") + expect(page).to have_content("Last edited by #{user.name}") expect(page).to have_content('My awesome wiki!') end @@ -69,7 +69,7 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do click_button 'Create page' expect(page).to have_content('Hyphens in the name') - expect(page).to have_content("last edited by #{user.name}") + expect(page).to have_content("Last edited by #{user.name}") expect(page).to have_content('My awesome wiki!') end end @@ -85,7 +85,7 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do click_button 'Create page' expect(page).to have_content('Home') - expect(page).to have_content("last edited by #{user.name}") + expect(page).to have_content("Last edited by #{user.name}") expect(page).to have_content('My awesome wiki!') end end @@ -105,7 +105,7 @@ feature 'Projects > Wiki > User creates wiki page', feature: true do click_button 'Create page' expect(page).to have_content('Foo') - expect(page).to have_content("last edited by #{user.name}") + expect(page).to have_content("Last edited by #{user.name}") expect(page).to have_content('My awesome wiki!') end end diff --git a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb index ef82d2375dd9bd22a74eee27f80671b0fc6d40d9..f842d14fa962e66d145f09e3dd73fa4273df3394 100644 --- a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb @@ -22,7 +22,7 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do click_button 'Save changes' expect(page).to have_content('Home') - expect(page).to have_content("last edited by #{user.name}") + expect(page).to have_content("Last edited by #{user.name}") expect(page).to have_content('My awesome wiki!') end end @@ -37,7 +37,7 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do click_button 'Save changes' expect(page).to have_content('Home') - expect(page).to have_content("last edited by #{user.name}") + expect(page).to have_content("Last edited by #{user.name}") expect(page).to have_content('My awesome wiki!') end end