-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from DFE-Digital/move-conditional-content-to-s…
…ame-level-as-controlling-element Fix alignment of conditional content beneath radio buttons and checkboxes
- Loading branch information
Showing
7 changed files
with
57 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'rspec/expectations' | ||
|
||
RSpec::Matchers.define :have_root_element_with_class do |class_name| | ||
# We're using xpath here because there's no sane way (ie without wrapping | ||
# everything in a useless element just for testing) of checking that elements | ||
# appear at the root of the fragment | ||
# | ||
# Note that the ./* matches ANY element `*` at the root `./` of the fragment | ||
match do |nokogiri_fragment| | ||
!nokogiri_fragment.xpath(%(./*[contains(concat(" ", @class, " "), " #{class_name} ")])).empty? | ||
end | ||
|
||
#:nocov: | ||
failure_message do |nokogiri_fragment| | ||
"expected that #{class_name} would be a class of a root element in fragment: #{nokogiri_fragment}" | ||
end | ||
#:nocov: | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters