-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a11y(arpa): fix headings and color contrast issues #3811
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ hr { | |
color: $positive-default; | ||
} | ||
|
||
.usdr-tab-nav-link { | ||
.usdr-link { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to reviewer: renamed the class to be general as it only contains color setting. |
||
color: #305CE0; | ||
} | ||
|
||
|
@@ -100,6 +100,14 @@ hr { | |
color: rgba(0,0,0) | ||
} | ||
|
||
.btn.usdr-btn-outline-primary, | ||
.btn.usdr-btn-outline-primary:hover { | ||
color: $usdr-brand-primary; | ||
background-color: #ffffff; | ||
border-color: $usdr-brand-primary; | ||
} | ||
|
||
a.usdr-btn-primary, | ||
.btn.usdr-btn-primary, | ||
.btn.usdr-btn-primary:hover { | ||
color: #ffff; | ||
|
@@ -120,4 +128,8 @@ hr { | |
-ms-flex: 1 1 0%; | ||
flex: 1 1 0%; | ||
min-width: 0; | ||
} | ||
|
||
.usdr-table-danger { | ||
background-color: #FDD3D6; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
<div class="mb-4"> | ||
<router-link | ||
to="/agencies/new" | ||
class="btn btn-primary" | ||
class="btn usdr-btn-primary" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
> | ||
Create New Agency | ||
</router-link> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,143 @@ | ||
import LoginView from '@/arpa_reporter/views/LoginView.vue'; | ||
|
||
import { describe, it, expect } from 'vitest'; | ||
import { shallowMount } from '@vue/test-utils'; | ||
import { | ||
describe, it, afterEach, vi, expect, | ||
} from 'vitest'; | ||
import { | ||
fireEvent, render, screen, cleanup, waitFor, | ||
} from '@testing-library/vue'; | ||
|
||
const mockPost = vi.fn(); | ||
global.fetch = mockPost; | ||
|
||
describe('LoginView component', () => { | ||
const $route = { | ||
query: {}, | ||
}; | ||
|
||
it('renders', () => { | ||
const wrapper = shallowMount(LoginView, { | ||
const mockRouter = { | ||
push: vi.fn(), | ||
resolve: vi.fn().mockReturnValue({ | ||
href: '/arpa_reporter/', | ||
}), | ||
}; | ||
|
||
afterEach(() => { | ||
cleanup(); | ||
vi.clearAllMocks(); | ||
mockPost.mockClear(); | ||
}); | ||
|
||
it('it displays expected elements and handles successful login request', async () => { | ||
mockPost.mockResolvedValueOnce( | ||
new Promise((resolve) => { | ||
resolve({ | ||
ok: true, | ||
success: true, | ||
json: () => Promise.resolve({ message: 'Email sent to [email protected]. Check your inbox', success: true }), | ||
}); | ||
}), | ||
); | ||
|
||
render(LoginView, { | ||
global: { | ||
mocks: { | ||
$route, | ||
$http: { post: mockPost }, | ||
$router: mockRouter, | ||
}, | ||
}, | ||
}); | ||
|
||
screen.getByRole('heading', { name: /ARPA Reporter Login/i, level: 1 }); | ||
const emailInput = screen.getByPlaceholderText(/email address/i); | ||
const submitButton = screen.getByRole('button'); | ||
|
||
await fireEvent.update(emailInput, '[email protected]'); | ||
await fireEvent.click(submitButton); | ||
|
||
await waitFor(() => screen.getByText(/Email sent to [email protected]. Check your inbox/i)); | ||
}); | ||
|
||
it('handles login error response', async () => { | ||
mockPost.mockResolvedValueOnce( | ||
new Promise((resolve) => { | ||
resolve({ | ||
ok: true, | ||
success: true, | ||
json: () => Promise.resolve({ message: 'User "[email protected]" not found', success: true }), | ||
}); | ||
}), | ||
); | ||
|
||
render(LoginView, { | ||
global: { | ||
mocks: { | ||
$route, | ||
$http: { post: mockPost }, | ||
$router: mockRouter, | ||
}, | ||
}, | ||
}); | ||
expect(wrapper.exists()).toBe(true); | ||
|
||
const emailInput = screen.getByPlaceholderText(/email address/i); | ||
const submitButton = screen.getByRole('button'); | ||
|
||
await fireEvent.update(emailInput, '[email protected]'); | ||
await fireEvent.click(submitButton); | ||
|
||
await waitFor(() => screen.getByText(/User "[email protected]" not found/i)); | ||
}); | ||
|
||
it('validates email format before submission', async () => { | ||
render(LoginView, { | ||
global: { | ||
mocks: { | ||
$route, | ||
$http: { post: mockPost }, | ||
$router: mockRouter, | ||
}, | ||
}, | ||
}); | ||
|
||
const emailInput = screen.getByPlaceholderText(/email address/i); | ||
const submitButton = screen.getByRole('button'); | ||
|
||
await fireEvent.update(emailInput, 'invalid-email'); | ||
await fireEvent.click(submitButton); | ||
|
||
expect(mockPost).not.toHaveBeenCalled(); | ||
screen.getByText(/please enter a valid email/i); | ||
}); | ||
it('handles login error status', async () => { | ||
mockPost.mockResolvedValueOnce( | ||
new Promise((resolve) => { | ||
resolve({ | ||
ok: false, | ||
success: true, | ||
statusText: 'Unable to connect to the server', | ||
status: 500, | ||
json: () => Promise.resolve({ }), | ||
}); | ||
}), | ||
); | ||
|
||
render(LoginView, { | ||
global: { | ||
mocks: { | ||
$route, | ||
$http: { post: mockPost }, | ||
$router: mockRouter, | ||
}, | ||
}, | ||
}); | ||
|
||
const emailInput = screen.getByPlaceholderText(/email address/i); | ||
const submitButton = screen.getByRole('button'); | ||
|
||
await fireEvent.update(emailInput, '[email protected]'); | ||
await fireEvent.click(submitButton); | ||
|
||
await waitFor(() => screen.getByText(/login: Unable to connect to the server \(500\)/i)); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
<!-- eslint-disable vuejs-accessibility/no-autofocus --> | ||
<template> | ||
<div class="my-3"> | ||
<h2>ARPA Reporter Login</h2> | ||
<h1>ARPA Reporter Login</h1> | ||
<form @submit="login"> | ||
<div class="form-group"> | ||
<input | ||
|
@@ -16,7 +16,7 @@ | |
</div> | ||
<div class="form-group"> | ||
<button | ||
class="btn btn-primary" | ||
class="btn usdr-btn-primary" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
type="Submit" | ||
@click="login" | ||
> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ export default { | |
name: 'submit', | ||
type: 'submit', | ||
label: 'Submit', | ||
inputClass: ['btn', 'btn-primary'], | ||
inputClass: ['btn', 'usdr-btn-primary'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}, | ||
{ | ||
type: 'button', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
<div class="mb-4"> | ||
<router-link | ||
to="/reporting_periods/new" | ||
class="btn btn-primary" | ||
class="btn usdr-btn-primary" | ||
> | ||
Create New Reporting Period | ||
</router-link> | ||
|
@@ -36,14 +36,15 @@ | |
<router-link | ||
v-if="!p.certified_at" | ||
:to="`/new_template/${p.id}`" | ||
class="usdr-link" | ||
> | ||
Upload Template | ||
</router-link> | ||
</td> | ||
<td> | ||
<span v-if="isCurrentReportingPeriod(p)"> | ||
<button | ||
class="btn btn-primary" | ||
class="btn usdr-btn-primary" | ||
data-toggle="modal" | ||
data-target="#certify-reporting-period" | ||
:disabled="certifying" | ||
|
@@ -97,7 +98,7 @@ | |
<div class="modal-footer"> | ||
<button | ||
type="button" | ||
class="btn btn-primary" | ||
class="btn usdr-btn-primary" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
@click="handleCertify" | ||
> | ||
Certify | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewer: before/after screenshots
Before
After