-
Notifications
You must be signed in to change notification settings - Fork 2
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 #71 from SFDigitalServices/release-6.0.4
Release 6.0.4
- Loading branch information
Showing
12 changed files
with
102 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* eslint-env jest */ | ||
import { createForm, destroyForm } from '../lib/test-helpers' | ||
import '../dist/formio-sfds.standalone.js' | ||
|
||
describe('a11y', () => { | ||
describe('input labels', () => { | ||
it('textfield inputs have associated labels', async () => { | ||
const form = await createForm({ | ||
type: 'form', | ||
display: 'form', | ||
components: [ | ||
{ | ||
type: 'textfield', | ||
key: 'name', | ||
label: 'Name', | ||
input: true | ||
}, | ||
{ | ||
type: 'container', | ||
key: 'nested', | ||
components: [ | ||
{ | ||
type: 'number', | ||
key: 'age', | ||
label: 'Age', | ||
input: true | ||
} | ||
] | ||
} | ||
] | ||
}, {}) | ||
|
||
const inputs = form.element.querySelectorAll('input') | ||
const labels = form.element.querySelectorAll('label:not(.control-label--hidden)') | ||
expect(inputs).toHaveLength(2) | ||
expect(labels).toHaveLength(2) | ||
|
||
const [nameField, ageField] = inputs | ||
const [nameLabel, ageLabel] = labels | ||
expect(nameField.name).toBe('data[name]') | ||
expect(nameField.id).toBe(`input-${nameField.name}`) | ||
expect(nameLabel.getAttribute('for')).toBe(nameField.id) | ||
|
||
expect(ageField.name).toBe('data[nested][age]') | ||
expect(ageField.id).toBe(`input-${ageField.name}`) | ||
expect(ageLabel.getAttribute('for')).toBe(ageField.id) | ||
|
||
destroyForm(form) | ||
}) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
module.exports = { | ||
bail: 1 | ||
bail: 1, | ||
setupFiles: ['<rootDir>/lib/test-setup.js'] | ||
} |
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,10 @@ | ||
/* eslint-env jest */ | ||
import 'regenerator-runtime' | ||
import 'formiojs/dist/formio.full.min.js' | ||
|
||
// jsdom doesn't provide an implementation for these, and it throws an error if | ||
// you call them directly. Thankfully, Jest can spy on and mock them. See: | ||
// <https://github.com/jsdom/jsdom/issues/1422> | ||
const scroll = jest.fn() | ||
jest.spyOn(window, 'scroll').mockImplementation(scroll) | ||
jest.spyOn(window, 'scrollTo').mockImplementation(scroll) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
acfc0f7
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.
Successfully deployed to the following URLs: