-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into VIV-1518-module-formats
- Loading branch information
Showing
15 changed files
with
239 additions
and
130 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,106 @@ | ||
# Publishes a branch as a pre-release version to npm | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
change_type: | ||
description: 'Determines which part of the version to increment (major, minor, patch)' | ||
required: true | ||
default: 'minor' | ||
type: choice | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
|
||
preview_version: | ||
description: 'Number at the end of the version string (3.0.0-preview.X). Increment by 1 for each pre-release version.' | ||
required: true | ||
type: string | ||
default: '0' | ||
|
||
name: pre-release | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: set-vivid-version | ||
working-directory: ./libs/components | ||
run: | | ||
npm version ${{ github.event.inputs.change_type }} --no-git-tag-version | ||
VERSION=$(node -p "require('./package.json').version")-preview.${{ github.event.inputs.preview_version }} | ||
npm version $VERSION --no-git-tag-version | ||
- name: sync-vivid-vue-version | ||
working-directory: ./libs/vue-wrappers | ||
run: | | ||
npm version $(node -p "require('../components/package.json').version") --no-git-tag-version | ||
- name: build | ||
run: | | ||
npm ci --ignore-scripts | ||
npx nx run components:build | ||
npx nx run components:generateMeta | ||
npx nx run vue-wrappers:build | ||
- name: upload-artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: release-artifacts | ||
path: dist/ | ||
|
||
npm-publish: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Download Build | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: release-artifacts | ||
path: dist/ | ||
|
||
- name: publish vivid npm package | ||
run: npm publish --tag preview dist/libs/components --//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_VVD_VNG_AUTOMATION_TOKEN }} | ||
|
||
- name: publish vivid-vue npm package | ||
run: npm publish --tag preview dist/libs/vue-wrappers --//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_VVD_VNG_AUTOMATION_TOKEN }} | ||
|
||
github-publish: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Download Build | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: release-artifacts | ||
path: dist/ | ||
|
||
- name: publish vivid to github packages | ||
run: npm publish --tag preview ./dist/libs/components --registry=https://npm.pkg.github.com --//npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.VNG_VVD_PAT }} | ||
|
||
- name: publish vivid-vue to github packages | ||
run: npm publish --tag preview ./dist/libs/vue-wrappers --registry=https://npm.pkg.github.com --//npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.VNG_VVD_PAT }} |
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
Binary file modified
BIN
-4.79 KB
(36%)
...-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Desktop-Chromium-linux.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 modified
BIN
-7.81 KB
(31%)
...b-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Desktop-Firefox-linux.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 modified
BIN
-4.66 KB
(37%)
...mb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Desktop-Safari-linux.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,33 @@ | ||
# Breadcrumb | ||
|
||
Breadcrumbs helps users navigate through a website or web application by showing the current location within the hierarchy of pages, | ||
and by providing links to navigate back to pages higher in the hierarchy. | ||
|
||
```js | ||
<script type="module"> | ||
import '@vonage/vivid/breadcrumb'; | ||
</script> | ||
``` | ||
|
||
## Use Cases | ||
|
||
### Common Usage | ||
|
||
```html preview | ||
<vwc-breadcrumb> | ||
<vwc-breadcrumb-item href="#" text="Breadcrumb"></vwc-breadcrumb-item> | ||
<vwc-breadcrumb-item href="#" text="Breadcrumb"></vwc-breadcrumb-item> | ||
<vwc-breadcrumb-item href="#" text="Breadcrumb"></vwc-breadcrumb-item> | ||
<vwc-breadcrumb-item text="Breadcrumb"></vwc-breadcrumb-item> | ||
</vwc-breadcrumb> | ||
``` | ||
|
||
### Multiple hidden crumbs | ||
|
||
```html preview | ||
<vwc-breadcrumb> | ||
<vwc-breadcrumb-item text="Breadcrumb" href="#"></vwc-breadcrumb-item> | ||
<vwc-breadcrumb-item text="..."></vwc-breadcrumb-item> | ||
<vwc-breadcrumb-item text="Breadcrumb"></vwc-breadcrumb-item> | ||
</vwc-breadcrumb> | ||
``` |
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,61 +1,43 @@ | ||
import * as path from 'path'; | ||
import { expect, test } from '@playwright/test'; | ||
import type { Page } from '@playwright/test'; | ||
import { | ||
extractHTMLBlocksFromReadme, | ||
loadComponents, | ||
loadTemplate, | ||
} from '../../visual-tests/visual-tests-utils.js'; | ||
|
||
const components = ['breadcrumb', 'breadcrumb-item']; | ||
|
||
function runBreadcrumbsTest() { | ||
return async ({page}: { page: Page }) => { | ||
const template = [ | ||
`<vwc-breadcrumb> | ||
<vwc-breadcrumb-item href="#" text="breadcrumb"></vwc-breadcrumb-item> | ||
<vwc-breadcrumb-item href="#" text="breadcrumb"></vwc-breadcrumb-item> | ||
<vwc-breadcrumb-item href="#" text="breadcrumb"></vwc-breadcrumb-item> | ||
<vwc-breadcrumb-item text="breadcrumb"></vwc-breadcrumb-item> | ||
</vwc-breadcrumb>`, | ||
`<vwc-breadcrumb> | ||
<vwc-breadcrumb-item href="#" text="breadcrumb"></vwc-breadcrumb-item> | ||
<vwc-breadcrumb-item text="..."></vwc-breadcrumb-item> | ||
<vwc-breadcrumb-item href="#" text="breadcrumb"></vwc-breadcrumb-item> | ||
</vwc-breadcrumb>` | ||
].reduce( | ||
(htmlString: string, block: string) => | ||
`${htmlString} <div style="margin: 5px;">${block}</div>`, | ||
'' | ||
); | ||
|
||
page.setViewportSize({ | ||
width: 500, | ||
height: 720 | ||
}); | ||
|
||
await loadComponents({ | ||
page, | ||
components, | ||
}); | ||
await loadTemplate({ | ||
page, | ||
template, | ||
}); | ||
|
||
const testWrapper = await page.$('#wrapper'); | ||
|
||
await page.waitForLoadState('networkidle'); | ||
|
||
await page.waitForSelector('vwc-breadcrumb-item:last-child'); | ||
await page.waitForSelector('div:nth-child(2) vwc-breadcrumb-item:last-child'); | ||
|
||
await page.evaluate(() => document.querySelector('vwc-breadcrumb-item:last-child').separator = false); | ||
await page.evaluate(() => document.querySelector('div:nth-child(2) vwc-breadcrumb-item:last-child').separator = false); | ||
|
||
expect(await testWrapper?.screenshot()) | ||
.toMatchSnapshot( | ||
'./snapshots/breadcrumb.png' | ||
); | ||
}; | ||
} | ||
|
||
test('should show the component', runBreadcrumbsTest()); | ||
test('should show the component', async ({ page }: { page: Page }) => { | ||
const template = extractHTMLBlocksFromReadme( | ||
path.join(new URL('.', import.meta.url).pathname, 'README.md') | ||
).reduce( | ||
(htmlString: string, block: string) => | ||
`${htmlString} <div style="margin: 5px;">${block}</div>`, | ||
'' | ||
); | ||
|
||
page.setViewportSize({ width: 500, height: 720 }); | ||
|
||
|
||
await loadComponents({ | ||
page, | ||
components, | ||
}); | ||
|
||
await loadTemplate({ | ||
page, | ||
template, | ||
}); | ||
|
||
const testWrapper = await page.$('#wrapper'); | ||
|
||
await page.keyboard.press('Tab'); | ||
|
||
await page.waitForLoadState('networkidle'); | ||
|
||
expect(await testWrapper?.screenshot()).toMatchSnapshot( | ||
'./snapshots/breadcrumb.png' | ||
); | ||
}); |
Binary file modified
BIN
+1.7 KB
(150%)
...breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Desktop-Chromium-linux.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 modified
BIN
+1.89 KB
(130%)
.../breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Desktop-Firefox-linux.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 modified
BIN
+1.63 KB
(150%)
...b/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Desktop-Safari-linux.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
Oops, something went wrong.