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

Commit b05cde3

Browse files
committed
Merge branch 'develop' of github.com:chakra-ui/chakra-ui-vue-next into feat/modal
2 parents 24c0fbd + aff686d commit b05cde3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1343
-629
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ lerna-debug.log*
1616
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
1717

1818
# Runtime data
19-
pids
19+
pids
2020
*.pid
2121
*.seed
2222
*.pid.lock

cypress.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"componentFolder": "packages/",
3+
"pluginsFile": "./tests/plugins.js",
4+
"testFiles": "**/*.cy.*",
5+
"supportFile": "./tests/support.tsx",
6+
"ignoreTestFiles": "**/*.snap",
7+
"video": false,
8+
"fixturesFolder": false,
9+
"reporter": "spec"
10+
}

index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!--
2+
This file is required for Vite to run at the root of the project.
3+
It's very difficult to avoid this.
4+
One option is to move the playground/index.html up here instead.
5+
-->
6+
<!DOCTYPE html>
7+
<html lang="en">
8+
<head>
9+
<meta charset="utf-8" />
10+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
11+
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
12+
<title>Cypress's Test Playground</title>
13+
</head>
14+
<body></body>
15+
</html>
16+

package.json

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"workspaces": [
99
"packages/*",
1010
"tooling/*",
11-
"website"
11+
"website",
12+
"tests"
1213
],
1314
"scripts": {
1415
"pkg": "manypkg run",
@@ -21,7 +22,11 @@
2122
"build": "lerna run build --no-private --stream",
2223
"dev": "NODE_ENV=development vite serve playground --config ./vite.config.ts --open",
2324
"playground:build": "yarn install && yarn build && yarn bootstrap && NODE_ENV=production vite build playground --config ./vite.config.ts",
24-
"test": "cross-env NODE_ENV=test jest --config jest.config.js",
25+
"cy:open": "cypress open-ct",
26+
"cy:run": "cypress run-ct --quiet",
27+
"test:component": "yarn cy:run",
28+
"test": "jest && yarn cy:run",
29+
"test:unit": "cross-env NODE_ENV=test jest --config jest.config.js",
2530
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
2631
"docs:dev:legacy": "vitepress dev docs",
2732
"docs:build:legacy": "vitepress build docs",
@@ -69,6 +74,7 @@
6974
"@vueuse/integrations": "^4.8.1",
7075
"@vueuse/motion": "^1.5.4",
7176
"aria-hidden": "^1.1.2",
77+
"@vueuse/core": "4.9.1",
7278
"axe-core": "^4.1.2",
7379
"babel-jest": "^26.6.3",
7480
"body-scroll-lock": "^3.1.5",
@@ -113,17 +119,22 @@
113119
"ts-jest": "^26.5.0",
114120
"ts-node": "^9.0.0",
115121
"typescript": "^4.1.3",
116-
"vite": "^2.2.3",
122+
"vite": "2.2.4",
117123
"vite-plugin-components": "^0.8.3",
118124
"vite-plugin-pages": "^0.9.2",
119125
"vitepress": "^0.12.0",
120-
"vue": ">=3.0.5",
126+
"vue": "^3.0.11",
121127
"vue-jest": "^5.0.0-alpha.7",
122128
"vue-prism-editor": "^2.0.0-alpha.2",
123129
"vue-router": "^4.0.6",
124130
"vue3-perfect-scrollbar": "^1.5.5"
125131
},
126132
"devDependencies": {
127-
"@babel/plugin-transform-runtime": "^7.13.15"
133+
"@babel/plugin-transform-runtime": "^7.13.15",
134+
"@cypress/snapshot": "^2.1.7",
135+
"@cypress/vite-dev-server": "^1.2.6",
136+
"@cypress/vue": "^3.0.1",
137+
"@vue/test-utils": "^2.0.0-rc.6",
138+
"cypress": "^7.2.0"
128139
}
129140
}

packages/c-accordion/tests/__snapshots__/c-accordion.test.ts.snap

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import CAccordion from '../src'
2+
import { h } from 'vue'
3+
4+
it('should render properly', () => {
5+
cy.mount(<CAccordion></CAccordion>)
6+
})

packages/c-accordion/tests/c-accordion.test.ts

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

packages/c-accordion/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.json",
33
"include": ["src"]
4-
}
4+
}

packages/c-alert/examples/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export * as BaseAlert from './base-alert.vue'
2+
export * as WithAccent from './with-accent.vue'
3+
export * as WithIcon from './with-icon.vue'
4+
export * as WithStatus from './with-status.vue'
5+
export * as WithTitle from './with-title.vue'

packages/c-alert/tests/__snapshots__/c-alert.test.ts.snap

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

packages/c-alert/tests/c-alert.cy.tsx

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+
import { h } from 'vue'
3+
import { CAlert, CAlertDescription, CAlertIcon, CAlertTitle } from '../src'
4+
5+
describe('Alert Examples', () => {
6+
Object.entries(Examples).map(([name, example]) => {
7+
it(`renders ${name} successfully`, () => {
8+
cy.mount(example.default)
9+
.then(() => {})
10+
.checkA11y()
11+
})
12+
})
13+
})
14+
15+
it('contains the correct role', () => {
16+
cy.mount(Examples.BaseAlert.default)
17+
.then(() => {})
18+
.get('[role=alert]')
19+
.should('exist')
20+
})
21+
22+
it('renders its children', () => {
23+
cy.mount(
24+
<CAlert data-testid="alert" variant="left-accent" status="info" mb="3">
25+
<CAlertIcon mr="2" />
26+
<CAlertTitle> Info alert </CAlertTitle>
27+
<CAlertDescription> Something just happened </CAlertDescription>
28+
</CAlert>
29+
)
30+
.get('[data-testid=alert]')
31+
.should('contain', 'Info alert')
32+
.and('contain', 'Something just happened')
33+
.and('descendants', 'svg')
34+
})

packages/c-alert/tests/c-alert.test.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * as WithButtonGroup from './with-button-group.vue'

packages/c-button/examples/button.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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 WithButtonSize from '../examples/with-button-size.vue'
5+
export * as WithButtonIcon from '../examples/with-button-icon.vue'
6+
export * as WithButtonVariants from '../examples/with-button-variants.vue'
7+
export * as WithLoadingStatus from '../examples/with-loading-status.vue'

packages/c-button/examples/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * as Button from './button'
2+
export * as ButtonGroup from './button-group'

packages/c-button/src/button-group.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { computed, defineComponent, h, PropType } from 'vue'
1+
import { computed, ComputedRef, defineComponent, h, PropType } from 'vue'
22
import {
33
SystemCSSProperties,
44
SystemStyleObject,
@@ -34,9 +34,9 @@ const props = {
3434
...vueThemingProps,
3535
}
3636

37-
type ButtonGroupContext = () => ThemingProps & {
37+
type ButtonGroupContext = ComputedRef<ThemingProps & {
3838
isDisabled?: boolean
39-
}
39+
}>
4040

4141
const [ButtonGroupProvider, useButtonGroup] = createContext<ButtonGroupContext>(
4242
{
@@ -49,12 +49,13 @@ const CButtonGroup = defineComponent({
4949
name: 'CButtonGroup',
5050
props,
5151
setup(props, { attrs, slots }) {
52-
ButtonGroupProvider(() => ({
52+
ButtonGroupProvider(computed(() => ({
5353
size: props.size,
5454
colorScheme: props.colorScheme,
5555
variant: props.variant,
5656
isDisabled: props.isDisabled,
57-
}))
57+
})))
58+
5859
const styles = computed(() => {
5960
let groupStyles: SystemStyleObject = {
6061
display: 'inline-flex',
@@ -76,7 +77,9 @@ const CButtonGroup = defineComponent({
7677

7778
return groupStyles
7879
})
80+
7981
return () => {
82+
8083
return h(
8184
chakra('div', { label: 'button__group' }),
8285
{

0 commit comments

Comments
 (0)