-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
1,274 additions
and
1 deletion.
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
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ const componentNames = [ | |
'link', | ||
'skeleton', | ||
'tooltip', | ||
'button', | ||
//--generator-anchor-- | ||
]; | ||
|
||
|
21 changes: 21 additions & 0 deletions
21
packages/ods/react/tests/_app/src/components/ods-button.tsx
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,21 @@ | ||
import React from 'react-dom/client'; | ||
import { OdsButton } from 'ods-components-react'; | ||
|
||
const Button = () => { | ||
function onClick() { | ||
console.log('React button click'); | ||
} | ||
|
||
return ( | ||
<> | ||
<OdsButton label="My button" | ||
onClick={ onClick } /> | ||
|
||
<OdsButton isDisabled={ true } | ||
label="My button" | ||
onClick={ onClick } /> | ||
</> | ||
); | ||
}; | ||
|
||
export default Button; |
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,51 @@ | ||
import type { Page } from 'puppeteer'; | ||
import { goToComponentPage, setupBrowser } from '../setup'; | ||
|
||
describe('ods-button react', () => { | ||
const setup = setupBrowser(); | ||
let page: Page; | ||
|
||
beforeAll(async () => { | ||
page = setup().page; | ||
}); | ||
|
||
beforeEach(async () => { | ||
await goToComponentPage(page, 'ods-button'); | ||
}); | ||
|
||
it('render the component correctly', async () => { | ||
const elem = await page.$('ods-button'); | ||
const boundingBox = await elem?.boundingBox(); | ||
|
||
expect(boundingBox?.height).toBeGreaterThan(0); | ||
expect(boundingBox?.width).toBeGreaterThan(0); | ||
}); | ||
|
||
it('trigger the click handler on click', async () => { | ||
const elem = await page.$('ods-button:not(:disabled)'); | ||
let consoleLog = '' | ||
page.on('console', (consoleObj) => { | ||
consoleLog = consoleObj.text() | ||
}); | ||
|
||
await elem?.click(); | ||
// Small delay to ensure page console event has been resolved | ||
await new Promise((resolve) => setTimeout(resolve, 100)); | ||
|
||
expect(consoleLog).toBe('React button click'); | ||
}); | ||
|
||
it('does not trigger the click handler on click if disabled', async () => { | ||
const elem = await page.$('ods-button:disabled'); | ||
let consoleLog = '' | ||
page.on('console', (consoleObj) => { | ||
consoleLog = consoleObj.text() | ||
}); | ||
|
||
await elem?.click(); | ||
// Small delay to ensure page console event has been resolved | ||
await new Promise((resolve) => setTimeout(resolve, 100)); | ||
|
||
expect(consoleLog).toBe(''); | ||
}); | ||
}); |
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
16 changes: 16 additions & 0 deletions
16
packages/ods/src/components/button/documentation/migration.from.17.x.mdx
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,16 @@ | ||
## Attributes changes | ||
|
||
`dummy` <img src="https://img.shields.io/badge/removed-FF0000" /> | ||
|
||
Has been removed. | ||
|
||
You can use the new `better-dummy` attribute to obtain the same rendering. | ||
|
||
## Migration examples | ||
|
||
Dummy button: | ||
```html | ||
<ods-button dummy></ods-button> | ||
<!-- is now --> | ||
<ods-button better-dummy></ods-button> | ||
``` |
1 change: 1 addition & 0 deletions
1
packages/ods/src/components/button/documentation/specifications/spec.md
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 @@ | ||
# Content of this file will be auto-generated |
7 changes: 7 additions & 0 deletions
7
...ds/src/components/button/documentation/specifications/specifications-button.mdx
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,7 @@ | ||
import { Markdown } from '@storybook/blocks'; | ||
import Specs from './spec.md'; | ||
|
||
## Description | ||
TODO write a description | ||
|
||
<Markdown>{ Specs }</Markdown> |
13 changes: 13 additions & 0 deletions
13
packages/ods/src/components/button/documentation/usage-guidelines/usage.mdx
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 @@ | ||
import { Canvas } from '@storybook/addon-docs'; | ||
|
||
## Usage | ||
|
||
### Default | ||
|
||
<Canvas sourceState="none"> | ||
<ods-button></ods-button> | ||
</Canvas> | ||
|
||
```html | ||
<ods-button></ods-button> | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "@ovhcloud/ods-component-button", | ||
"version": "17.1.0", | ||
"private": true, | ||
"description": "ODS Button component", | ||
"main": "dist/index.cjs.js", | ||
"collection": "dist/collection/collection-manifest.json", | ||
"scripts": { | ||
"clean": "rimraf .stencil coverage dist docs-api www", | ||
"doc": "typedoc --pretty --plugin ../../../scripts/typedoc-plugin-decorator.js && node ../../../scripts/generate-typedoc-md.js", | ||
"lint:scss": "stylelint 'src/components/**/*.scss'", | ||
"lint:ts": "eslint 'src/**/*.{js,ts,tsx}'", | ||
"start": "stencil build --dev --watch --serve", | ||
"test:e2e": "stencil test --e2e --config stencil.config.ts", | ||
"test:e2e:ci": "tsc --noEmit && stencil test --e2e --ci --config stencil.config.ts", | ||
"test:spec": "stencil test --spec --config stencil.config.ts --coverage", | ||
"test:spec:ci": "tsc --noEmit && stencil test --config stencil.config.ts --spec --ci --coverage" | ||
} | ||
} |
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
Oops, something went wrong.