-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from AppQuality/new-datepicker
New datepicker
- Loading branch information
Showing
22 changed files
with
7,807 additions
and
587 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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { defineConfig, devices } from "@playwright/experimental-ct-react17"; | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: "./", | ||
/* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */ | ||
snapshotDir: "./__snapshots__", | ||
/* Maximum time one test can run for. */ | ||
timeout: 10 * 1000, | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: "html", | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: "on-first-retry", | ||
|
||
/* Port to use for Playwright component endpoint. */ | ||
ctPort: 3100, | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: "chromium", | ||
use: { ...devices["Desktop Chrome"] }, | ||
}, | ||
{ | ||
name: "firefox", | ||
use: { ...devices["Desktop Firefox"] }, | ||
}, | ||
{ | ||
name: "webkit", | ||
use: { ...devices["Desktop Safari"] }, | ||
}, | ||
], | ||
}); |
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,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Testing Page</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="./index.tsx"></script> | ||
</body> | ||
</html> |
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 @@ | ||
// Import styles, initialize component theme here. | ||
// import '../src/common.css'; | ||
import React from "react"; | ||
import { beforeMount } from "@playwright/experimental-ct-react17/hooks"; | ||
import GlobalStyle from "../src/shared/globalStyle"; | ||
import { ThemeProvider } from "styled-components"; | ||
import { aqBootstrapTheme } from "../src/stories/theme/defaultTheme"; | ||
|
||
beforeMount(async ({ App }) => { | ||
return ( | ||
<ThemeProvider theme={aqBootstrapTheme}> | ||
<GlobalStyle /> | ||
<App /> | ||
</ThemeProvider> | ||
); | ||
}); |
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,18 @@ | ||
import { test, expect } from "@playwright/experimental-ct-react17"; | ||
import DateInput from "."; | ||
|
||
test.describe("DateInput", () => { | ||
test("should render an input tag and a button to open a datepicker", async ({ | ||
page, | ||
mount, | ||
}) => { | ||
const component = await mount(<DateInput id="datepicker" />); | ||
component.locator("input").click(); | ||
expect(component).toBeTruthy(); | ||
}); | ||
test("should print a placeholder if any", async ({ page, mount }) => {}); | ||
test("should accept a date in a specific format", async ({ | ||
page, | ||
mount, | ||
}) => {}); | ||
}); |
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,22 @@ | ||
import DateInput from "."; | ||
import { Story, Meta } from "@storybook/react"; | ||
import { DatepickerGlobalStyle } from "./_style"; | ||
|
||
export default { | ||
title: "Inputs/DateInput", | ||
component: DateInput, | ||
} as Meta; | ||
|
||
const DatepickerTemplate: Story = (args) => ( | ||
<> | ||
<DatepickerGlobalStyle /> | ||
<h2>Seleziona una data nel formato gg-mm-aaaa</h2> | ||
<DateInput {...args} id="test1" i18n={{ placeholder: "28-03-2013" }} /> | ||
</> | ||
); | ||
export const DatepickerInput = DatepickerTemplate.bind({}); | ||
DatepickerInput.args = { | ||
onChange: ({ value }: { value: Date }) => { | ||
console.log(value); | ||
}, | ||
}; |
Oops, something went wrong.