Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kr8n3r committed Nov 29, 2019
1 parent 3972ac7 commit bea7861
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions spec/components/feedback_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ def component_name
it "asks the user if the page is useful without javascript enabled" do
render_component({})

assert_select ".gem-c-feedback .gem-c-feedback__prompt-link--useful[href='/contact/govuk']", text: 'Yes this page is useful'
assert_select ".gem-c-feedback .gem-c-feedback__option-list-item--useful a[href='/contact/govuk']", text: 'Yes this page is useful'
assert_select ".gem-c-feedback .gem-c-feedback__prompt-link.js-page-is-not-useful[href='/contact/govuk']", text: 'No this page is not useful'
end

it "asks the user if there is anything wrong with the page without javascript enabled" do
render_component({})

assert_select ".gem-c-feedback .gem-c-feedback__prompt-link--wrong[href='/contact/govuk']", text: 'Is there anything wrong with this page?'
assert_select ".gem-c-feedback .gem-c-feedback__option-list-item--wrong a[href='/contact/govuk']", text: 'Is there anything wrong with this page?'
end

it "removes top margin when margin_top flag is set" do
Expand Down
21 changes: 17 additions & 4 deletions spec/javascripts/components/feedback-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,24 @@ describe('Feedback component', function () {
'<div class="gem-c-feedback__prompt js-prompt" tabindex="-1">' +
'<div class="js-prompt-questions">' +
'<h3 class="gem-c-feedback__is-useful-question">Is this page useful?</h3>' +
'<a href="/contact/govuk" class="gem-c-feedback__prompt-link gem-c-feedback__prompt-link--useful js-page-is-useful" data-track-category="yesNoFeedbackForm" data-track-action="ffYesClick">Yes <span class="visually-hidden">this page is useful</span></a>' +
'<a href="/contact/govuk" class="gem-c-feedback__prompt-link js-toggle-form js-page-is-not-useful" data-track-category="yesNoFeedbackForm" data-track-action="ffNoClick" aria-controls="page-is-not-useful" aria-expanded="false">No <span class="visually-hidden">this page is not useful</span></a>' +
'<a href="/contact/govuk" class="gem-c-feedback__prompt-link gem-c-feedback__prompt-link--wrong js-toggle-form js-something-is-wrong" data-track-category="Onsite Feedback" data-track-action="GOV.UK Open Form" aria-controls="something-is-wrong" aria-expanded="false">Is there anything wrong with this page?</a>' +
'<ul class="gem-c-feedback__option-list">' +
'<li class="gem-c-feedback__option-list-item gem-c-feedback__option-list-item--useful">' +
'<a class="gem-c-feedback__prompt-link js-page-is-useful" data-track-category="yesNoFeedbackForm" data-track-action="ffYesClick" aria-expanded="false" role="button" href="/contact/govuk">' +
'Yes <span class="visually-hidden">this page is useful</span>' +
'</a>' +
'</li>' +
'<li class="gem-c-feedback__option-list-item gem-c-feedback__option-list-item--not-useful">' +
'<a class="gem-c-feedback__prompt-link js-toggle-form js-page-is-not-useful" data-track-category="yesNoFeedbackForm" data-track-action="ffNoClick" aria-controls="page-is-not-useful" aria-expanded="false" role="button" href="/contact/govuk">' +
'No <span class="visually-hidden">this page is not useful</span>' +
'</a>' +
'</li>' +
'<li class="gem-c-feedback__option-list-item gem-c-feedback__option-list-item--wrong">' +
'<a class="gem-c-feedback__prompt-link js-toggle-form js-something-is-wrong" data-track-category="Onsite Feedback" data-track-action="GOV.UK Open Form" aria-controls="something-is-wrong" aria-expanded="false" role="button" href="/contact/govuk">' +
'Is there anything wrong with this page?' +
'</a>' +
'</li>' +
'</ul>' +
'</div>' +

'<div class="gem-c-feedback__prompt-success js-prompt-success js-hidden" tabindex="-1">' +
'Thanks for your feedback.' +
'</div>' +
Expand Down

0 comments on commit bea7861

Please sign in to comment.