|
46 | 46 | expect(page.find_all('.grid-col-12').size).to eq 2 |
47 | 47 | end |
48 | 48 | end |
| 49 | + |
| 50 | + describe 'last used csp was CLEAR' do |
| 51 | + let(:url) { '/' } |
| 52 | + let(:component) { described_class.new(url, last_used_csp: :clear) } |
| 53 | + before { render_inline(component) } |
| 54 | + |
| 55 | + it 'wraps only the CLEAR button' do |
| 56 | + # Check that the right button has the "last used" wrapper. |
| 57 | + expect(page).to have_css('.last-used-login-wrapper .clear-login-button__logo') |
| 58 | + |
| 59 | + # Make sure the other two don't. |
| 60 | + expect(page).not_to have_css('.last-used-login-wrapper .idme-login-button__logo') |
| 61 | + expect(page).not_to have_css('.last-used-login-wrapper .lg-login-button__logo') |
| 62 | + end |
| 63 | + end |
| 64 | + |
| 65 | + describe 'last used csp was ID.me' do |
| 66 | + let(:url) { '/' } |
| 67 | + let(:component) { described_class.new(url, last_used_csp: :id_me) } |
| 68 | + before { render_inline(component) } |
| 69 | + |
| 70 | + it 'wraps only the ID.me button' do |
| 71 | + # Check that the right button has the "last used" wrapper. |
| 72 | + expect(page).to have_css('.last-used-login-wrapper .idme-login-button__logo') |
| 73 | + |
| 74 | + # Make sure the other two don't. |
| 75 | + expect(page).not_to have_css('.last-used-login-wrapper .clear-login-button__logo') |
| 76 | + expect(page).not_to have_css('.last-used-login-wrapper .lg-login-button__logo') |
| 77 | + end |
| 78 | + end |
| 79 | + |
| 80 | + describe 'last used csp was Login.gov' do |
| 81 | + let(:url) { '/' } |
| 82 | + let(:component) { described_class.new(url, last_used_csp: :login_dot_gov) } |
| 83 | + before { render_inline(component) } |
| 84 | + |
| 85 | + it 'wraps only the Login.gov button' do |
| 86 | + # Check that the right button has the "last used" wrapper. |
| 87 | + expect(page).to have_css('.last-used-login-wrapper .lg-login-button__logo') |
| 88 | + |
| 89 | + # Make sure the other two don't. |
| 90 | + expect(page).not_to have_css('.last-used-login-wrapper .clear-login-button__logo') |
| 91 | + expect(page).not_to have_css('.last-used-login-wrapper .idme-login-button__logo') |
| 92 | + end |
| 93 | + |
| 94 | + describe 'no last used csp' do |
| 95 | + let(:url) { '/' } |
| 96 | + let(:component) { described_class.new(url, last_used_csp: nil) } |
| 97 | + before { render_inline(component) } |
| 98 | + |
| 99 | + it "doesn't wrap any buttons" do |
| 100 | + expect(page).not_to have_css('.last-used-login-wrapper .clear-login-button__logo') |
| 101 | + expect(page).not_to have_css('.last-used-login-wrapper .idme-login-button__logo') |
| 102 | + expect(page).not_to have_css('.last-used-login-wrapper .lg-login-button__logo') |
| 103 | + end |
| 104 | + end |
| 105 | + end |
49 | 106 | end |
0 commit comments