-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests(ui): add unit testing boilerplate and first tests (#12047)
Co-authored-by: Evert van der Weit <[email protected]> Co-authored-by: Paolo Caleffi <[email protected]>
- Loading branch information
1 parent
1350c76
commit 0542537
Showing
54 changed files
with
6,872 additions
and
11 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"johnsoncodehk.volar" | ||
], | ||
} |
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,6 +1,10 @@ | ||
{ | ||
"eslint.workingDirectories": [ | ||
"./docs", | ||
"./ui" | ||
] | ||
"eslint.format.enable": false, | ||
"editor.formatOnSave": false, | ||
"eslint.workingDirectories": ["./docs", "./ui"], | ||
"editor.tabSize": 2, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
}, | ||
"eslint.validate": ["javascript", "vue"] | ||
} |
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 |
---|---|---|
|
@@ -14,3 +14,4 @@ cordova | |
debug.log | ||
package-lock.json | ||
.vscode | ||
__diff_output__ |
Binary file added
BIN
+4.5 KB
...ent -- (prop) label -- should show the label centered when not focused.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.44 KB
... content -- (prop) label -- should show the label stacked when focused.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.4 KB
...ategory content -- (prop) stack-label -- should show the label stacked.snap.png
Loading
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,13 @@ | ||
{ | ||
"fixturesFolder": "../test/cypress/fixtures", | ||
"screenshotsFolder": "../test/cypress/screenshots", | ||
"videosFolder": "../test/cypress/videos", | ||
"videoCompression": false, | ||
"videoUploadOnPasses": false, | ||
"component": { | ||
"componentFolder": "../src", | ||
"testFiles": "**/*.spec.js", | ||
"pluginsFile": "../test/cypress/plugins/unit.js", | ||
"supportFile": "../test/cypress/support/unit.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,121 @@ | ||
import { mount } from '@cypress/vue' | ||
import QAvatar from '../QAvatar' | ||
|
||
describe('Avatar API', () => { | ||
describe('Props', () => { | ||
describe('Category: content', () => { | ||
describe('(prop): icon', () => { | ||
it('should render an icon', () => { | ||
const icon = 'bug_report' | ||
mount(QAvatar, { | ||
props: { | ||
icon, | ||
color: 'grey' | ||
} | ||
}) | ||
|
||
cy.get('.q-avatar') | ||
.get('.q-icon') | ||
.should('have.text', `${ icon }`) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Category: style', () => { | ||
describe('(prop): font-size', () => { | ||
it('should set the font-size', () => { | ||
const size = '40px' | ||
// Doing em/rem units here does not work | ||
// Cypress looks at actual computed values in the browser | ||
const fontSize = '32px' | ||
mount(QAvatar, { | ||
props: { | ||
size, | ||
fontSize, | ||
color: 'grey' | ||
} | ||
}) | ||
|
||
cy.get('.q-avatar') | ||
.should('have.css', 'font-size', size) | ||
.get('.q-avatar__content') | ||
.should('have.css', 'font-size', fontSize) | ||
}) | ||
}) | ||
|
||
describe('(prop): color', () => { | ||
it('should set a background color', () => { | ||
const color = 'red' | ||
mount(QAvatar, { | ||
props: { | ||
color | ||
} | ||
}) | ||
|
||
cy.get('.q-avatar') | ||
.should('have.class', `bg-${ color }`) | ||
}) | ||
}) | ||
|
||
describe('(prop): text-color', () => { | ||
it('should set a text color', () => { | ||
const textColor = 'red' | ||
mount(QAvatar, { | ||
props: { | ||
textColor | ||
} | ||
}) | ||
|
||
cy.get('.q-avatar') | ||
.should('have.class', `text-${ textColor }`) | ||
}) | ||
}) | ||
|
||
describe('(prop): square', () => { | ||
it('should create a square avatar', () => { | ||
mount(QAvatar, { | ||
props: { | ||
square: true, | ||
color: 'grey' | ||
} | ||
}) | ||
|
||
cy.get('.q-avatar') | ||
.should('have.class', 'q-avatar--square') | ||
.should('have.css', 'border-radius', '0px') | ||
}) | ||
}) | ||
|
||
describe('(prop): rounded', () => { | ||
it('should create a rounded avatar', () => { | ||
mount(QAvatar, { | ||
props: { | ||
rounded: true, | ||
color: 'grey' | ||
} | ||
}) | ||
|
||
cy.get('.q-avatar') | ||
.should('have.class', 'rounded-borders') | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Slots', () => { | ||
describe('(slot): default', () => { | ||
it('render the text in the default slot', () => { | ||
const text = 'QQ' | ||
mount(QAvatar, { | ||
slots: { | ||
// Using only a string here results in an error, this is a workaround | ||
default: () => text | ||
} | ||
}) | ||
|
||
cy.get('.q-avatar') | ||
.should('have.text', text) | ||
}) | ||
}) | ||
}) | ||
}) |
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,74 @@ | ||
// import { mount } from '@cypress/vue' | ||
// import QBadge from '../QBadge' | ||
|
||
// const snapshotOptions = { customSnapshotsDir: '../src/components/badge/__tests__' } | ||
|
||
describe('Badge API', () => { | ||
describe('Props', () => { | ||
describe('Category: content', () => { | ||
describe('(prop): floating', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
|
||
describe('(prop): multi-line', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
|
||
describe('(prop): label', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
|
||
describe('(prop): align', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Category: style', () => { | ||
describe('(prop): color', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
|
||
describe('(prop): text-color', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
|
||
describe('(prop): transparent', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
|
||
describe('(prop): outline', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
|
||
describe('(prop): rounded', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Slots', () => { | ||
describe('(slot): default', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
}) | ||
}) |
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,55 @@ | ||
describe('Btn API', () => { | ||
describe('Props', () => { | ||
describe('Category: behavior', () => { | ||
describe('(prop): percentage', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
|
||
describe('(prop): dark-percentage', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Category: style', () => { | ||
describe('(prop): round', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Slots', () => { | ||
describe('(slot): default', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
|
||
describe('(slot): loading', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Events', () => { | ||
describe('(event): click', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Methods', () => { | ||
describe('(method): click', () => { | ||
it.skip(' ', () => { | ||
// | ||
}) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.