-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(checkbox): export & dependencies
- Loading branch information
1 parent
7e7eff3
commit 091dd6d
Showing
13 changed files
with
55 additions
and
52 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
packages-new/common/stencil/src/e2e/osds-set-property-function.ts
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,43 @@ | ||
import type { E2EPage } from '@stencil/core/testing'; | ||
import type { odsPickMethods } from '@ovhcloud/ods-common-core'; | ||
import type { SerializableOrJSHandle } from 'puppeteer'; | ||
|
||
/** | ||
* set a property on a component that is a function. | ||
* it will manage the scope and declare your function as global in order to access it into | ||
* the context of the page evaluation. | ||
* | ||
* passing through a page eval may be work better than : | ||
* ``` | ||
* // here this does not work - must use page.$eval | ||
* el.setProperty('save', myCbk); | ||
* ``` | ||
* | ||
* @see https://github.com/puppeteer/puppeteer/issues/982 | ||
* @param page - stencil page context of test | ||
* @param selector - A selector to query the component to test | ||
* @param property - name of the property to set | ||
* @param fct - function to set as value of the property | ||
*/ | ||
async function osdsSetPropertyFunction<Attributes, | ||
K extends odsPickMethods<Attributes> = odsPickMethods<Attributes>, | ||
T extends keyof K = keyof K>(page: E2EPage, selector: string, property: T, fct: K[T]): Promise<void> { | ||
function cbk() { | ||
return fct; | ||
} | ||
|
||
await page.exposeFunction("cbk", cbk); | ||
const props = { property }; | ||
await page.$eval(selector, | ||
(elm: Element, properties) => { | ||
const property = (properties as typeof props).property; | ||
const el = elm as unknown as K; | ||
el[ property ] = cbk(); | ||
}, | ||
props as SerializableOrJSHandle | ||
); | ||
} | ||
|
||
export { | ||
osdsSetPropertyFunction, | ||
}; |
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 @@ | ||
export * from './osds-set-property-function'; |
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 +1,2 @@ | ||
export * from './config/stencil-config'; | ||
export * from './e2e/public-api'; |
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 was deleted.
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
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
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
6 changes: 3 additions & 3 deletions
6
packages-new/components/checkbox/src/components/osds-checkbox/public-api.ts
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