forked from uswds/uswds
-
Notifications
You must be signed in to change notification settings - Fork 0
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 uswds#4329 from uswds/gsq-xss-audit
USWDS | xss audit, standardization
- Loading branch information
Showing
33 changed files
with
720 additions
and
479 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
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
21 changes: 12 additions & 9 deletions
21
spec/unit/character-count/invalid-template-no-message.spec.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const assert = require('assert'); | ||
const CharacterCount = require('../../../src/js/components/character-count'); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const assert = require("assert"); | ||
const CharacterCount = require("../../../src/js/components/character-count"); | ||
|
||
const INVALID_TEMPLATE_NO_MESSAGE = fs.readFileSync(path.join(__dirname, '/invalid-template-no-message.template.html')); | ||
const INVALID_TEMPLATE_NO_MESSAGE = fs.readFileSync( | ||
path.join(__dirname, "/invalid-template-no-message.template.html") | ||
); | ||
|
||
describe('character count component without message', () => { | ||
describe("character count component without message", () => { | ||
const { body } = document; | ||
|
||
afterEach(() => { | ||
body.textContent = ''; | ||
body.textContent = ""; | ||
CharacterCount.off(body); | ||
}); | ||
|
||
it('should throw an error when a character count component is created with no message element', () => { | ||
it("should throw an error when a character count component is created with no message element", () => { | ||
body.innerHTML = INVALID_TEMPLATE_NO_MESSAGE; | ||
assert.throws(() => CharacterCount.on(), { | ||
message: '.usa-character-count is missing inner .usa-character-count__message', | ||
message: | ||
".usa-character-count is missing inner .usa-character-count__message", | ||
}); | ||
}); | ||
}); |
21 changes: 12 additions & 9 deletions
21
spec/unit/character-count/invalid-template-no-wrapper.spec.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const assert = require('assert'); | ||
const CharacterCount = require('../../../src/js/components/character-count'); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const assert = require("assert"); | ||
const CharacterCount = require("../../../src/js/components/character-count"); | ||
|
||
const INVALID_TEMPLATE_NO_WRAPPER = fs.readFileSync(path.join(__dirname, '/invalid-template-no-wrapper.template.html')); | ||
const INVALID_TEMPLATE_NO_WRAPPER = fs.readFileSync( | ||
path.join(__dirname, "/invalid-template-no-wrapper.template.html") | ||
); | ||
|
||
describe('character count input without wrapping element', () => { | ||
describe("character count input without wrapping element", () => { | ||
const { body } = document; | ||
|
||
afterEach(() => { | ||
body.textContent = ''; | ||
body.textContent = ""; | ||
CharacterCount.off(body); | ||
}); | ||
|
||
it('should throw an error when a character count component is created with no wrapping class', () => { | ||
it("should throw an error when a character count component is created with no wrapping class", () => { | ||
body.innerHTML = INVALID_TEMPLATE_NO_WRAPPER; | ||
assert.throws(() => CharacterCount.on(), { | ||
message: '.usa-character-count__field is missing outer .usa-character-count', | ||
message: | ||
".usa-character-count__field is missing outer .usa-character-count", | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,22 +1,24 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const assert = require('assert'); | ||
const ComboBox = require('../../../src/js/components/combo-box'); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const assert = require("assert"); | ||
const ComboBox = require("../../../src/js/components/combo-box"); | ||
|
||
const INVALID_TEMPLATE_NO_MESSAGE = fs.readFileSync(path.join(__dirname, '/invalid-template-no-select.template.html')); | ||
const INVALID_TEMPLATE_NO_MESSAGE = fs.readFileSync( | ||
path.join(__dirname, "/invalid-template-no-select.template.html") | ||
); | ||
|
||
describe('character count component without message', () => { | ||
describe("character count component without message", () => { | ||
const { body } = document; | ||
|
||
afterEach(() => { | ||
body.textContent = ''; | ||
body.textContent = ""; | ||
ComboBox.off(body); | ||
}); | ||
|
||
it('should throw an error when a combo box component is created with no select element', () => { | ||
it("should throw an error when a combo box component is created with no select element", () => { | ||
body.innerHTML = INVALID_TEMPLATE_NO_MESSAGE; | ||
assert.throws(() => ComboBox.on(), { | ||
message: '.usa-combo-box is missing inner select', | ||
message: ".usa-combo-box is missing inner select", | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.