diff --git a/app/assets/stylesheets/govuk_elements/_forms.scss b/app/assets/stylesheets/govuk_elements/_forms.scss index ff3c95ee2..ffc71315f 100644 --- a/app/assets/stylesheets/govuk_elements/_forms.scss +++ b/app/assets/stylesheets/govuk_elements/_forms.scss @@ -1,20 +1,74 @@ // Forms // ========================================================================== -// GOV.UK front end toolkit dependencies -@import "helpers"; -@import "../govuk_frontend_toolkit/colours"; + +// Contents: +// +// 1. Helpers +// 2. Form wrappers +// 3. Form labels +// 4. Form hints +// 5. Form controls +// 6. Form control widths +// 7. Browser accessibility fixes + +// 1. Helpers +// ========================================================================== // Fieldset is used to group more than one .form-group fieldset { @extend %contain-floats; width: 100%; + + // Avoid extra vertical space (caused by fieldsets preventing margin collapse) when fieldsets with an h1 in the legend appear after the error-summary element. + // (Class used instead of adjacent sibling selector for IE 8 compatibility.) + &.after-error-summary { + margin-top: -$gutter-half; + + @include media(tablet) { + margin-top: -$gutter; + } + } } -// Form group is used to wrap label and input pairs +// Hack to let legends or elements within legends have margins in webkit browsers +legend { + overflow: hidden; +} + +// Fix left hand gap in IE7 and below +@include ie-lte(7) { + legend { + margin-left: -7px; + } +} + +// Remove margin under textarea in Chrome and FF +textarea { + display: block; +} + + +// 2. Form wrappers +// ========================================================================== + +.form-section, .form-group { @extend %contain-floats; float: left; width: 100%; +} + +// Form section is used to wrap .form-group and has twice its margin +.form-section { + margin-bottom: $gutter; + + @include media(tablet) { + margin-bottom: $gutter * 2; + } +} + +// Form group is used to wrap label and input pairs +.form-group { margin-bottom: $gutter-half; @include media(tablet) { @@ -22,6 +76,7 @@ fieldset { } } +// Form group related is used to reduce the space between label and input pairs .form-group-related { margin-bottom: 10px; @@ -30,66 +85,68 @@ fieldset { } } +// Form group compound is used to reduce the space between label and input pairs .form-group-compound { margin-bottom: 10px; } -// Form title -.form-title { - margin-bottom: $gutter; - - @include media(tablet) { - margin-bottom: ($gutter*1.5); - } -} - - -// Labels +// 3. Form labels +// ========================================================================== // Form labels, or for legends styled to look like labels +// TODO: Amend so there is only one label style .form-label, .form-label-bold { display: block; color: $text-colour; + padding-bottom: 2px; } .form-label { @include core-19; - margin-bottom: 5px; } .form-label-bold { - @include bold-24; - margin-bottom: 0; - - .form-hint { - @include core-19; - } + @include bold-19; } -// Used for paragraphs in-between form elements +// Used for the 'or' in between block label options .form-block { - @extend %contain-floats; float: left; - width: 100%; -} + clear: left; + + margin-top: -5px; + margin-bottom: 5px; + @include media(tablet) { + margin-top: 0; + margin-bottom: 10px; + } +} -// Hints +// 4. Form hints +// ========================================================================== -// Form hints & examples are light grey and sit above a form control +// Form hints and example text are light grey and sit above a form control .form-hint { + @include core-19; display: block; color: $secondary-text-colour; - margin-bottom: 5px; + font-weight: normal; - @include media (tablet) { - margin-top: 8px; - } + margin-top: -2px; + padding-bottom: 2px; +} + +.form-label .form-hint, +.form-label-bold .form-hint { + margin-top: 0; + padding-bottom: 0; } -// Form controls +// 5. Form controls +// ========================================================================== // By default, form controls are 50% width for desktop, // and 100% width for mobile @@ -98,21 +155,42 @@ fieldset { @include core-19; width: 100%; - padding: 4px; - background-color: $white; - border: 1px solid $border-colour; - - // Disable webkit appearance and remove rounded corners - -webkit-appearance: none; - border-radius: 0; + padding: 5px 4px 4px; + // setting any background-color makes text invisible when changing colours to dark backgrounds in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1335476) + // as background-color and color need to always be set together, color should not be set either + border: 2px solid $text-colour; + // TODO: Remove 50% width set for tablet and up + // !! BREAKING CHANGE !! @include media(tablet) { width: 50%; } + } +// Allow a qualifying element, remove rounded corners from inputs and textareas +// scss-lint:disable QualifyingElement +input.form-control, +textarea.form-control { + // Disable inner shadow and remove rounded corners + -webkit-appearance: none; + border-radius: 0; +} + +textarea.form-control { + // Disable opacity and background image for Firefox + opacity: 1; + background-image: none; +} +// scss-lint:enable QualifyingElement + +// 6. Form control widths +// ========================================================================== + +// TODO: Update these // Form control widths + .form-control-3-4 { width: 100%; @@ -121,6 +199,14 @@ fieldset { } } +.form-control-2-3 { + width: 100%; + + @include media(tablet) { + width: 66.66%; + } +} + .form-control-1-2 { width: 100%; @@ -129,44 +215,38 @@ fieldset { } } -.form-control-1-4 { - width: 25%; -} +.form-control-1-3 { + width: 100%; -.form-control-1-8 { - width: 12.5%; + @include media(tablet) { + width: 33.33%; + } } +.form-control-1-4 { + width: 100%; -// Radio buttons -.form-radio { - display: block; - margin: 10px 0; - - input { - vertical-align: middle; - margin: -4px 5px 0 0; + @include media(tablet) { + width: 25%; } } +.form-control-1-8 { + width: 100%; -// Checkboxes -.form-checkbox { - display: block; - margin: $gutter-half 0; - - input { - vertical-align: middle; - margin: -2px 5px 0 0; + @include media(tablet) { + width: 12.5%; } } +// 7. Browser accessibility fixes +// ========================================================================== -// Buttons -.form .button { - @include media(mobile) { - width: 100%; - } +option:active, +option:checked, +select:focus::-ms-value { + color: $white; + background-color: $govuk-blue; } diff --git a/app/assets/stylesheets/govuk_frontend_toolkit/_colours.scss b/app/assets/stylesheets/govuk_frontend_toolkit/_colours.scss index a4a77376a..f4e293ee2 100644 --- a/app/assets/stylesheets/govuk_frontend_toolkit/_colours.scss +++ b/app/assets/stylesheets/govuk_frontend_toolkit/_colours.scss @@ -1,112 +1,2 @@ -// Colours for the site, as per: -// http://alphagov.github.com/design/gov.uk.colours/ - -// Departmental colours -$attorney-generals-office: #9f1888; -$cabinet-office: #005abb; -$civil-service: #af292e; -$department-for-business-innovation-skills: #003479; -$department-for-communities-and-local-government: #00857e; -$department-for-culture-media-sport: #d40072; -$department-for-education: #003a69; -$department-for-environment-food-rural-affairs: #898700; -$department-for-international-development: #002878; -$department-for-transport: #006c56; -$department-for-work-pensions: #00beb7; -$department-of-energy-climate-change: #009ddb; -$department-of-health: #00ad93; -$foreign-commonwealth-office: #003e74; -$government-equalities-office: #9325b2; -$hm-government: #0076c0; -$hm-revenue-customs: #009390; -$hm-treasury: #af292e; -$home-office: #9325b2; -$ministry-of-defence: #4d2942; -$ministry-of-justice: #231f20; -$northern-ireland-office: #002663; -$office-of-the-advocate-general-for-scotland: #002663; -$office-of-the-leader-of-the-house-of-lords: #9c132e; -$scotland-office: #002663; -// Note: the 'the' part here will get dropped -$the-office-of-the-leader-of-the-house-of-commons: #317023; -$uk-export-finance: #005747; -$uk-trade-investment: #C80651; -$wales-office: #a33038; - -// Brand colours -$govuk-blue: #005ea5; -$mainstream-brand: $govuk-blue; - -// Standard palette, colours -$purple: #2e358b; -$purple-50: #9799c4; -$purple-25: #d5d6e7; -$mauve: #6f72af; -$mauve-50: #b7b9d7; -$mauve-25: #e2e2ef; -$fuschia: #912b88; -$fuschia-50: #c994c3; -$fuschia-25: #e9d4e6; -$pink: #d53880; -$pink-50: #eb9bbe; -$pink-25: #f6d7e5; -$baby-pink: #f499be; -$baby-pink-50: #faccdf; -$baby-pink-25: #fdebf2; -$red: #b10e1e; -$red-50: #d9888c; -$red-25: #efcfd1; -$mellow-red: #df3034; -$mellow-red-50: #ef9998; -$mellow-red-25: #f9d6d6; -$orange: #f47738; -$orange-50: #fabb96; -$orange-25: #fde4d4; -$brown: #b58840; -$brown-50: #dac39c; -$brown-25: #f0e7d7; -$yellow: #ffbf47; -$yellow-50: #ffdf94; -$yellow-25: #fff2d3; -$grass-green: #85994b; -$grass-green-50: #c2cca3; -$grass-green-25: #e7ebda; -$green: #006435; -$green-50: #7fb299; -$green-25: #cce0d6; -$turquoise: #28a197; -$turquoise-50: #95d0cb; -$turquoise-25: #d5ecea; -$light-blue: #2b8cc4; -$light-blue-50: #96c6e2; -$light-blue-25: #d5e8f3; - -// Standard palette, greys -$black: #0b0c0c; -$grey-1: #6f777b; -$grey-2: #bfc1c3; -$grey-3: #dee0e2; -$grey-4: #f8f8f8; -$white: #fff; - -// Semantic colour names -$link-colour: $govuk-blue; -$link-active-colour: #2e8aca; -$link-hover-colour: #2e8aca; -$link-visited-colour: #4c2c92; -$button-colour: #00823b; -$focus-colour: $yellow; -$text-colour: $black; // Standard text colour -$secondary-text-colour: $grey-1; // Section headers, help text etc. -$border-colour: $grey-2; // Borders, seperators, rules, keylines etc. -$panel-colour: $grey-3; // Related links panel, page footer etc. -$canvas-colour: $grey-4; // Page background -$highlight-colour: $grey-4; // Table stripes etc. -$page-colour: $white; // The page -$discovery-colour: $fuschia; // Discovery badges and banners -$alpha-colour: $pink; // Alpha badges and banners -$beta-colour: $orange; // Beta badges and banners -$live-colour: $grass-green; // Live badges and banners -$banner-text-colour: #000; // Text colour for Alpha & Beta banners -$error-colour: $red; // Error text and border colour -$error-background: #fef7f7; // Error background colour +@import "colours/palette"; +@import "colours/organisation"; diff --git a/app/assets/stylesheets/govuk_frontend_toolkit/colours/_organisation.scss b/app/assets/stylesheets/govuk_frontend_toolkit/colours/_organisation.scss new file mode 100644 index 000000000..99e4aad76 --- /dev/null +++ b/app/assets/stylesheets/govuk_frontend_toolkit/colours/_organisation.scss @@ -0,0 +1,104 @@ +// We use `websafe` to mean strong enough contrast against white to +// be used for copy and meet the AAA (large text) and AA (smaller +// copy) WCAG guidelines. + +$attorney-generals-office: #9f1888; +$attorney-generals-office-websafe: #a03a88; +$cabinet-office: #005abb; +$cabinet-office-websafe: #347da4; +$civil-service: #af292e; +$department-for-business-innovation-skills: #003479; +$department-for-business-innovation-skills-websafe: #347da4; +$department-for-communities-and-local-government: #00857e; +$department-for-communities-and-local-government-websafe: #37836e; +$department-for-culture-media-sport: #d40072; +$department-for-culture-media-sport-websafe: #a03155; +$department-for-education: #003a69; +$department-for-education-websafe: #347ca9; +$department-for-environment-food-rural-affairs: #00a33b; +$department-for-environment-food-rural-affairs-websafe: #008938; +$department-for-international-development: #002878; +$department-for-international-development-websafe: #405e9a; +$department-for-international-trade: #CF102D; +$department-for-international-trade-websafe: $link-colour; +$department-for-transport: #006c56; +$department-for-transport-websafe: #398373; +$department-for-work-pensions: #00beb7; +$department-for-work-pensions-websafe: #37807b; +$department-of-energy-climate-change: #009ddb; +$department-of-energy-climate-change-websafe: #2b7cac; +$department-of-health: #00ad93; +$department-of-health-websafe: #39836e; +$foreign-commonwealth-office: #003e74; +$foreign-commonwealth-office-websafe: #406e97; +$government-equalities-office: #9325b2; +$hm-government: #0076c0; +$hm-government-websafe: #347da4; +$hm-revenue-customs: #009390; +$hm-revenue-customs-websafe: #008670; +$hm-treasury: #af292e; +$hm-treasury-websafe: #832322; +$home-office: #9325b2; +$home-office-websafe: #9440b2; +$ministry-of-defence: #4d2942; +$ministry-of-defence-websafe: #5a5c92; +$ministry-of-justice: #231f20; +$ministry-of-justice-websafe: #5a5c92; +$northern-ireland-office: #002663; +$northern-ireland-office-websafe: #3e598c; +$office-of-the-advocate-general-for-scotland: #002663; +$office-of-the-advocate-general-for-scotland-websafe: $link-colour; +$office-of-the-leader-of-the-house-of-lords: #9c132e; +$office-of-the-leader-of-the-house-of-lords-websafe: #c2395d; +$scotland-office: #002663; +$scotland-office-websafe: #405c8a; +// Note: the 'the' part here will get dropped +$the-office-of-the-leader-of-the-house-of-commons: #317023; +$the-office-of-the-leader-of-the-house-of-commons-websafe: #005f8f; +$uk-export-finance: #005747; +$uk-export-finance-websafe: $link-colour; +$uk-trade-investment: #C80651; +$uk-trade-investment-websafe: $link-colour; +$wales-office: #a33038; +$wales-office-websafe: #7a242a; + +// All organisation colours in a list +// (class_name, brand colour, WCAG acceptible text colour) +// +// example usage: +// @each $organisation in $all-organisation-brand-colours { +// .#{nth($organisation, 1)} { +// border-color: nth($organisation, 2); +// } +// } + +$all-organisation-brand-colours: + 'attorney-generals-office' $attorney-generals-office $attorney-generals-office-websafe, + 'cabinet-office' $cabinet-office $cabinet-office-websafe, + 'civil-service' $civil-service $civil-service, + 'department-for-business-innovation-skills' $department-for-business-innovation-skills $department-for-business-innovation-skills-websafe, + 'department-for-communities-and-local-government' $department-for-communities-and-local-government $department-for-communities-and-local-government-websafe, + 'department-for-culture-media-sport' $department-for-culture-media-sport $department-for-culture-media-sport-websafe, + 'department-for-education' $department-for-education $department-for-education-websafe, + 'department-for-environment-food-rural-affairs' $department-for-environment-food-rural-affairs $department-for-environment-food-rural-affairs-websafe, + 'department-for-international-development' $department-for-international-development $department-for-international-development-websafe, + 'department-for-international-trade' $department-for-international-trade $department-for-international-trade-websafe, + 'department-for-transport' $department-for-transport $department-for-transport-websafe, + 'department-for-work-pensions' $department-for-work-pensions $department-for-work-pensions-websafe, + 'department-of-energy-climate-change' $department-of-energy-climate-change $department-of-energy-climate-change-websafe, + 'department-of-health' $department-of-health $department-of-health-websafe, + 'foreign-commonwealth-office' $foreign-commonwealth-office $foreign-commonwealth-office-websafe, + 'hm-government' $hm-government $hm-government-websafe, + 'hm-revenue-customs' $hm-revenue-customs $hm-revenue-customs-websafe, + 'hm-treasury' $hm-treasury $hm-treasury-websafe, + 'home-office' $home-office $home-office-websafe, + 'ministry-of-defence' $ministry-of-defence $ministry-of-defence-websafe, + 'ministry-of-justice' $ministry-of-justice $ministry-of-justice-websafe, + 'northern-ireland-office' $northern-ireland-office $northern-ireland-office-websafe, + 'office-of-the-advocate-general-for-scotland' $office-of-the-advocate-general-for-scotland $office-of-the-advocate-general-for-scotland-websafe, + 'office-of-the-leader-of-the-house-of-lords' $office-of-the-leader-of-the-house-of-lords $office-of-the-leader-of-the-house-of-lords-websafe, + 'scotland-office' $scotland-office $scotland-office-websafe, + 'the-office-of-the-leader-of-the-house-of-commons' $the-office-of-the-leader-of-the-house-of-commons $the-office-of-the-leader-of-the-house-of-commons-websafe, + 'uk-export-finance' $uk-export-finance $uk-export-finance-websafe, + 'uk-trade-investment' $uk-trade-investment $uk-trade-investment-websafe, + 'wales-office' $wales-office $wales-office-websafe; diff --git a/app/assets/stylesheets/govuk_frontend_toolkit/colours/_palette.scss b/app/assets/stylesheets/govuk_frontend_toolkit/colours/_palette.scss new file mode 100644 index 000000000..81d040e00 --- /dev/null +++ b/app/assets/stylesheets/govuk_frontend_toolkit/colours/_palette.scss @@ -0,0 +1,77 @@ +// Brand colours +$govuk-blue: #005ea5; +$mainstream-brand: $govuk-blue; + +// Standard palette, colours +$purple: #2e358b; +$purple-50: #9799c4; +$purple-25: #d5d6e7; +$mauve: #6f72af; +$mauve-50: #b7b9d7; +$mauve-25: #e2e2ef; +$fuschia: #912b88; +$fuschia-50: #c994c3; +$fuschia-25: #e9d4e6; +$pink: #d53880; +$pink-50: #eb9bbe; +$pink-25: #f6d7e5; +$baby-pink: #f499be; +$baby-pink-50: #faccdf; +$baby-pink-25: #fdebf2; +$red: #b10e1e; +$red-50: #d9888c; +$red-25: #efcfd1; +$mellow-red: #df3034; +$mellow-red-50: #ef9998; +$mellow-red-25: #f9d6d6; +$orange: #f47738; +$orange-50: #fabb96; +$orange-25: #fde4d4; +$brown: #b58840; +$brown-50: #dac39c; +$brown-25: #f0e7d7; +$yellow: #ffbf47; +$yellow-50: #ffdf94; +$yellow-25: #fff2d3; +$grass-green: #85994b; +$grass-green-50: #c2cca3; +$grass-green-25: #e7ebda; +$green: #006435; +$green-50: #7fb299; +$green-25: #cce0d6; +$turquoise: #28a197; +$turquoise-50: #95d0cb; +$turquoise-25: #d5ecea; +$light-blue: #2b8cc4; +$light-blue-50: #96c6e2; +$light-blue-25: #d5e8f3; + +// Standard palette, greys +$black: #0b0c0c; +$grey-1: #6f777b; +$grey-2: #bfc1c3; +$grey-3: #dee0e2; +$grey-4: #f8f8f8; +$white: #fff; + +// Semantic colour names +$link-colour: $govuk-blue; +$link-active-colour: $light-blue; +$link-hover-colour: $light-blue; +$link-visited-colour: #4c2c92; +$button-colour: #00823b; +$focus-colour: $yellow; +$text-colour: $black; // Standard text colour +$secondary-text-colour: $grey-1; // Section headers, help text etc. +$border-colour: $grey-2; // Borders, seperators, rules, keylines etc. +$panel-colour: $grey-3; // Related links panel, page footer etc. +$canvas-colour: $grey-4; // Page background +$highlight-colour: $grey-4; // Table stripes etc. +$page-colour: $white; // The page +$discovery-colour: $govuk-blue; // Discovery badges and banners +$alpha-colour: $govuk-blue; // Alpha badges and banners +$beta-colour: $govuk-blue; // Beta badges and banners +$live-colour: $grass-green; // Live badges and banners +$banner-text-colour: #000; // Text colour for Alpha & Beta banners +$error-colour: $red; // Error text and border colour +$error-background: #fef7f7; // Error background colour diff --git a/app/assets/stylesheets/petitions/_forms.scss b/app/assets/stylesheets/petitions/_forms.scss index 6c0cd36fc..5f7921b0a 100644 --- a/app/assets/stylesheets/petitions/_forms.scss +++ b/app/assets/stylesheets/petitions/_forms.scss @@ -7,22 +7,16 @@ select.form-control { height: 40px; - -webkit-appearance: menulist; - background-color: $panel-colour; - border: 1px solid $border-colour; -} -select.form-control:hover { - border-color: $black; -} - -.form-control.small { - width: 8.5em; @include media(tablet) { - width: 50%; + height: 52px; } } +.form-control.small { + width: 50%; +} + .form-control-1-4 { width: 25%; } diff --git a/app/assets/stylesheets/petitions/_search-inline.scss b/app/assets/stylesheets/petitions/_search-inline.scss index 2fc97a036..a614261c6 100644 --- a/app/assets/stylesheets/petitions/_search-inline.scss +++ b/app/assets/stylesheets/petitions/_search-inline.scss @@ -1,27 +1,30 @@ .search-inline { + position: relative; @extend %contain-floats; input.form-control { @include appearance(none); - @include box-sizing(content-box); + @include box-sizing(border-box); float: left; min-width: 0; margin: 0; - border-right: 0; - padding: 6px; - height: 26px; - width: 77%; - @include calc(width, "100% - 53px"); + padding: 6px 50px 6px 6px; + height: 42px; + width: 100%; } + #postcode { text-transform: uppercase; } .inline-submit { - float: left; - width: 40px; - height: 40px; + position: absolute; + right: 0; + top: 0; + width: 42px; + height: 42px; border: 0; + border-left: 2px solid $text-colour; overflow: hidden; text-indent: -5000px; cursor: pointer; diff --git a/app/assets/stylesheets/petitions/admin/views/_shared.scss b/app/assets/stylesheets/petitions/admin/views/_shared.scss index f51dc638c..6e949d817 100644 --- a/app/assets/stylesheets/petitions/admin/views/_shared.scss +++ b/app/assets/stylesheets/petitions/admin/views/_shared.scss @@ -1,4 +1,8 @@ .admin { + select.form-control { + height: 40px; + } + #content { margin-top: $gutter-half; } @@ -117,13 +121,40 @@ .tag-list { label { font-size: 14px; - padding: 5px 10px 5px 30px; - margin: 0 5px 5px 0; + padding: 2px 0 0 0; + margin: 0; + + &::before { + height: 18px; + width: 18px; + } + + &::after { + border-width: 0 0 3px 3px; + width: 9px; + height: 5px; + top: 6px; + left: 5px; + } } - input[type=checkbox] { - top: 4px; - left: 5px; + .multiple-choice { + padding: 0 0 0 27px; + margin: 0 10px 10px 0; + + input { + height: 20px; + width: 20px; + } + } + + .panel-indent { + margin: 15px 0 15px 0; + padding: 5px 0 5px 15px; + + p { + margin-top: 0; + } } } diff --git a/app/views/admin/admin/index.html.erb b/app/views/admin/admin/index.html.erb index 31b4d63dc..90bc99707 100644 --- a/app/views/admin/admin/index.html.erb +++ b/app/views/admin/admin/index.html.erb @@ -2,30 +2,35 @@
Search for or
- <%= label_tag :q, "Search", class: "visuallyhidden" %> - <%= search_field_tag "q", "", class: "form-control", placeholder:"Enter a search query" %> - <%= submit_tag 'Search', name: nil, class: 'inline-submit' %> +- - Match - - - -
- - Match - - - -
<% end %>- - Match - - - -
<% end %><%= filtered_petition_count(@petitions) %>
diff --git a/app/views/pages/home/_search_petitions.html.erb b/app/views/pages/home/_search_petitions.html.erb index 816fc90a9..3d5dac2cc 100644 --- a/app/views/pages/home/_search_petitions.html.erb +++ b/app/views/pages/home/_search_petitions.html.erb @@ -1,8 +1,10 @@<%= petition_list_header %>
<% end %> -<%= form_tag petitions_path, class: 'search-inline', method: 'get', enforce_utf8: false do %> - <%= search_field_tag 'q', @petitions.query, class: 'form-control', id: 'search' %> - <%= hidden_field_tag 'state', @petitions.scope %> - <%= submit_tag 'Search', name: nil, class: 'inline-submit' %> +<%= form_tag petitions_path, method: 'get', enforce_utf8: false do %> +<%= filtered_petition_count(@petitions) %>
diff --git a/features/admin/admin_users_crud.feature b/features/admin/admin_users_crud.feature index a381ed94f..d4becc537 100644 --- a/features/admin/admin_users_crud.feature +++ b/features/admin/admin_users_crud.feature @@ -41,9 +41,8 @@ Feature: Admin users index and crud And I should see a "First name" text field And I should see a "Last name" text field And I should see a "Email" text field - And I should see a "Role" select field with the following options: - | sysadmin | - | moderator | + And I should see a "sysadmin" radio field + And I should see a "moderator" radio field And I should see a "Force password reset" checkbox field And I should see a "Account disabled" checkbox field And I should see a "Password" password field @@ -55,14 +54,14 @@ Feature: Admin users index and crud And I fill in "First name" with "Derek" And I fill in "Last name" with "Jacobi" And I fill in "Email" with "derek@example.com" - And I select "sysadmin" from "Role" + And I choose "sysadmin" And I fill in "Password" with "Letmein1!" And I fill in "Password confirmation" with "Letmein1!" And I press "Save" Then I should be on the admin users index page And I should see "derek@example.com" When I follow "Jacobi, Derek" - Then the "Role" select field should have "sysadmin" selected + Then the "sysadmin" radio button should be chosen And the "Account disabled" checkbox should not be checked Scenario: Updating a user diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 06c0a948e..d70068853 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -161,6 +161,20 @@ def with_scope(locator) end end +Then /^the "([^"]*)" radio button(?: within "([^"]*)")? should be chosen$/ do |label, selector| + with_scope(selector) do + field_checked = find_field(label)['checked'] + expect(field_checked).to be_truthy + end +end + +Then /^the "([^"]*)" radio button(?: within "([^"]*)")? should not be chosen$/ do |label, selector| + with_scope(selector) do + field_checked = find_field(label)['checked'] + expect(field_checked).to be_falsey + end +end + Then /^(?:|I )should be on (.+)$/ do |page_name| url = URI.parse(current_url) url.query = nil