-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vite-ts example): add routing, e2e test, theming & data fetching…
… example (#5502)
- Loading branch information
Showing
25 changed files
with
616 additions
and
77 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,7 @@ | ||
import { Label, WrappingType } from '@ui5/webcomponents-react'; | ||
import React from 'react'; | ||
|
||
//mdx adds a paragraph to children if added inline, this component prevents that. | ||
export const LabelWithWrapping = ({ children }) => { | ||
return <Label wrappingType={WrappingType.Normal}>{children}</Label>; | ||
}; |
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,6 +1,6 @@ | ||
.card { | ||
width: 500px; | ||
height: 18rem; | ||
height: 20rem; | ||
margin-block-end: 2rem; | ||
flex-shrink: 0; | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
import { defineConfig } from 'cypress'; | ||
|
||
export default defineConfig({ | ||
includeShadowDom: true, | ||
viewportWidth: 1920, | ||
viewportHeight: 1080, | ||
component: { | ||
devServer: { | ||
framework: 'react', | ||
bundler: 'vite' | ||
} | ||
}, | ||
|
||
e2e: { | ||
baseUrl: 'http://localhost:5173/', | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
} | ||
} | ||
}); |
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,9 @@ | ||
// make sure to start your dev server before running e2e tests | ||
describe('E2E tests', () => { | ||
it('click list item', () => { | ||
cy.visit('/'); | ||
cy.clickUi5ListItemByText("Solve a Rubik's cube"); | ||
cy.url().should('eq', 'http://localhost:5173/todo/5'); | ||
cy.get('[value="Solve a Rubik\'s cube"]').should('be.visible').and('have.attr', 'ui5-input'); | ||
}); | ||
}); |
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,20 @@ | ||
// *********************************************************** | ||
// This example support/e2e.ts is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands'; | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import App from './App'; | ||
import { Button } from '@ui5/webcomponents-react'; | ||
|
||
describe('Component tests', () => { | ||
it('render Link component with text', () => { | ||
cy.mount(<App />); | ||
cy.get('[ui5-link]').should('be.visible').and('have.text', 'Getting Started with UI5 Web Component for React'); | ||
}); | ||
it('type into Input component', () => { | ||
cy.mount(<App />); | ||
cy.get('[ui5-input]').typeIntoUi5Input('Hello there!'); | ||
cy.get('[ui5-label]').should('be.visible').and('have.text', 'Hello there!'); | ||
// example for component test | ||
it('basic', () => { | ||
const clickSpy = cy.spy().as('clickSpy'); | ||
cy.mount(<Button onClick={clickSpy}>Click me!</Button>); | ||
cy.get('[ui5-button]').click(); | ||
cy.get('@clickSpy').should('have.been.calledOnce'); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.popover::part(content) { | ||
padding: 0; | ||
} |
Oops, something went wrong.