Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add visual regression tests (#6)
- Loading branch information
1 parent
2cd4fc2
commit 08fd3b6
Showing
11 changed files
with
144 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ script: | |
- npm run size | ||
- npm run lint | ||
- npm test | ||
- npm run test:visual |
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,28 @@ | ||
import { visualDiff } from '@web/test-runner-visual-regression'; | ||
import { fixture } from '@open-wc/testing-helpers'; | ||
import '../../hex-color-picker.js'; | ||
import '../../hsl-color-picker.js'; | ||
import '../../hsl-string-color-picker.js'; | ||
import '../../hsv-color-picker.js'; | ||
import '../../rgb-color-picker.js'; | ||
import '../../rgb-string-color-picker.js'; | ||
|
||
describe('visual tests', () => { | ||
let picker: HTMLElement; | ||
|
||
['hex', 'hsl', 'hsl-string', 'hsv', 'rgb', 'rgb-string'].forEach((type) => { | ||
describe(`${type}-color-picker`, () => { | ||
beforeEach(async () => { | ||
picker = await fixture(` | ||
<div style="display: flex; justify-content: center; width: 216px; padding: 8px"> | ||
<${type}-color-picker></${type}-color-picker> | ||
</div> | ||
`); | ||
}); | ||
|
||
it('should match screenshot', async () => { | ||
await visualDiff(picker, type); | ||
}); | ||
}); | ||
}); | ||
}); |
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