Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 2708c27

Browse files
committed
wip: error with isRef
1 parent c0c4d5f commit 2708c27

File tree

11 files changed

+116
-132
lines changed

11 files changed

+116
-132
lines changed

cypress.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"experimentalComponentTesting": true,
3-
"componentFolder": "packages/tests",
3+
"componentFolder": "packages/",
44
"pluginsFile": "./plugins.js",
55
"testFiles": "**/*.test.*",
66
"supportFile": "packages/tests/support.ts"

packages/c-button/examples/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export * as AsIconButton from './as-icon-button.vue'
2+
export * as BaseButton from './base-button.vue'
3+
export * as WithAttachedButtons from './with-attached-buttons.vue'
4+
export * as WithButtonGroup from '../examples/with-button-group.vue'
5+
export * as WithButtonSize from '../examples/with-button-size.vue'
6+
export * as withButtonIcon from '../examples/with-button-icon.vue'
7+
export * as WithButtonVariants from '../examples/with-button-variants.vue'
8+
export * as WithLoadingStatus from '../examples/with-loading-status.vue'

packages/c-button/tests/c-button.cy.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import * as Examples from '../examples'
2+
import { h } from 'vue'
3+
4+
5+
describe('Button Examples', () => {
6+
it('works', () => {
7+
expect(true).to.be.true
8+
})
9+
10+
Object.entries(Examples).map(([name, example]) => {
11+
it(`renders ${name} successfully`, () => {
12+
cy.mount(example.default).checkA11y()
13+
})
14+
})
15+
})

packages/c-popper/examples/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * as PopperV2Example from './popper-v2-example.vue'
2+
export * as PopperWithTransition from './popper-with-transition.vue'

packages/c-popper/tests/use-popper.test.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import * as Examples from '../examples'
2+
3+
import { h, onMounted } from 'vue'
4+
import { usePopper } from '../src'
5+
import { useToggle } from '@vueuse/core'
6+
7+
// Fails with isRef error
8+
xit('should work', () => {
9+
cy.mount({
10+
setup() {
11+
const [isOpen, toggleIsOpen] = useToggle(true)
12+
13+
const { reference, referenceEl, popperEl, popper } = usePopper({
14+
gutter: 16,
15+
placement: 'right-end',
16+
})
17+
18+
onMounted(() => {
19+
_referenceEl = referenceEl.value
20+
_popperEl = popperEl.value
21+
})
22+
23+
return {
24+
isOpen,
25+
toggleIsOpen,
26+
reference,
27+
popper,
28+
}
29+
}
30+
})
31+
})
32+
33+
34+

packages/tests/a11y.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import axeCore from 'axe-core'
2+
const isAccessible = (_chai, utils) => {
3+
4+
_chai.Assertion.addProperty('accessible', function () {
5+
let _this = this
6+
return cy.get('#cypress-root', { log: false }).then(async ($root) => {
7+
const result = await axeCore.run($root[0])
8+
const { passes, violations } = result
9+
10+
// @ts-ignore
11+
const assert = () => {
12+
_this.assert(
13+
violations.length <= 0,
14+
violations.length ? `🔨 ${violations.length} A11y checks failed. See console for output.` : `✅ A11y checks passed (${passes.length} passed}`
15+
)
16+
}
17+
18+
if (!violations.length) {
19+
return assert()
20+
}
21+
22+
passes.map(v => () => cy.log(`✅ A11y: ${v.help}`))
23+
.concat(violations.map(v => () => cy.log(`🚫 A11y: ${v.help}`)))
24+
// @ts-ignore
25+
.concat([() => cy.then(assert)])
26+
.forEach(f => f())
27+
})
28+
})
29+
}
30+
31+
chai.use(isAccessible)

packages/tests/c-accordion.test.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/tests/c-button.test.tsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)