Skip to content

Commit

Permalink
Added test step for GOV.UK JS style checkbox
Browse files Browse the repository at this point in the history
Also removed unused CSS, tidied JS
  • Loading branch information
thatkevin committed Feb 6, 2024
1 parent 56503d4 commit b72b072
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 24 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin-actions-autosave.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $(function() {
}

var debouncedSubmitForm = debounce(function() {
var form = $(this).closest('form');
var form = $(this).closest('form');
var headerOrLabel = form.prevAll('h2');
if(!headerOrLabel.length) {
headerOrLabel = $("label[for='" + $(this).attr('id') + "']");
Expand Down
20 changes: 0 additions & 20 deletions app/assets/stylesheets/petitions/admin/_actions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,6 @@
&:first-child {
margin-top: 0;
}

.saving-status {
height: 20px;
width: 20px;

&.saving-status-saving {
background-image: url(assets/icons/icon_saving.svg);
height: 26px;
width: 26px;
}
&.saving-status-saved {
background-image: url(assets/icons/icon_saved.svg);
height: 26px;
width: 26px;
}
.saving-info {
display: none;
}

}
}

.present::after {
Expand Down
6 changes: 3 additions & 3 deletions features/admin/moderator_tags_a_petition.feature
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ Feature: A moderator user updates records notes
And a tag exists with name: "DWP"
When I am on the admin all petitions page
And I follow "Solidarity with the Unions"
And I follow "Tags"
Then I leave the form alone for 1000ms
Then the "DWP" checkbox should not be checked
And I follow "Tags"
Then the "DWP" JS enabled govuk style checkbox should not be checked
When I check "DWP"
Then I leave the form alone for 1000ms
And I wait for the petition tags to save
Then I reload the page
Then the "DWP" checkbox should be checked
Then the "DWP" JS enabled govuk style checkbox should be checked
14 changes: 14 additions & 0 deletions features/step_definitions/moderator_tags_a_petition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@
end
end

Then /^the "([^"]*)" JS enabled govuk style checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
with_scope(selector) do
field_checked = find_field(label, visible: false)['checked']
expect(field_checked).to be_falsey
end
end

Then /^the "([^"]*)" JS enabled govuk style checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
with_scope(selector) do
field_checked = find_field(label, visible: false)['checked']
expect(field_checked).to be_truthy
end
end

def finished_ajax_requests?
!page.find('//body')[:class].include?('ajax-active')
end

0 comments on commit b72b072

Please sign in to comment.