-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into atoledano-more-testids
- Loading branch information
Showing
72 changed files
with
792 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
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 added
BIN
+1.76 KB
...design-tokens/.yarn/cache/@telefonica-prettier-config-npm-2.0.0-44dbed316e-b7fe4ee936.zip
Binary file not shown.
Binary file added
BIN
+1.9 MB
packages/generate-design-tokens/.yarn/cache/prettier-npm-3.3.3-e811f023f3-bc86043548.zip
Binary file not shown.
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 added
BIN
+2.61 KB
..._image_snapshots__/meter-screenshot-test-tsx-meter-default-angular-0-1-snap.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 added
BIN
+3.83 KB
...mage_snapshots__/meter-screenshot-test-tsx-meter-default-angular-100-1-snap.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 added
BIN
+4.23 KB
...hots__/meter-screenshot-test-tsx-meter-default-angular-20-20-20-20-0-1-snap.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 added
BIN
+3.76 KB
...ge_snapshots__/meter-screenshot-test-tsx-meter-default-angular-33-33-1-snap.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 added
BIN
+4.93 KB
...image_snapshots__/meter-screenshot-test-tsx-meter-default-circular-0-1-snap.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 added
BIN
+7.15 KB
...age_snapshots__/meter-screenshot-test-tsx-meter-default-circular-100-1-snap.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 added
BIN
+7.61 KB
...ots__/meter-screenshot-test-tsx-meter-default-circular-20-20-20-20-0-1-snap.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 added
BIN
+6.83 KB
...e_snapshots__/meter-screenshot-test-tsx-meter-default-circular-33-33-1-snap.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 added
BIN
+187 Bytes
...__image_snapshots__/meter-screenshot-test-tsx-meter-default-linear-0-1-snap.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 added
BIN
+234 Bytes
...image_snapshots__/meter-screenshot-test-tsx-meter-default-linear-100-1-snap.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 added
BIN
+388 Bytes
...shots__/meter-screenshot-test-tsx-meter-default-linear-20-20-20-20-0-1-snap.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 added
BIN
+323 Bytes
...age_snapshots__/meter-screenshot-test-tsx-meter-default-linear-33-33-1-snap.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 added
BIN
+3.85 KB
...ge_snapshots__/meter-screenshot-test-tsx-meter-inverse-angular-33-33-1-snap.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 added
BIN
+7.03 KB
...e_snapshots__/meter-screenshot-test-tsx-meter-inverse-circular-33-33-1-snap.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 added
BIN
+324 Bytes
...age_snapshots__/meter-screenshot-test-tsx-meter-inverse-linear-33-33-1-snap.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 added
BIN
+32.8 KB
...mage_snapshots__/meter-screenshot-test-tsx-meter-media-angular-33-33-1-snap.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 added
BIN
+59.3 KB
...age_snapshots__/meter-screenshot-test-tsx-meter-media-circular-33-33-1-snap.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 added
BIN
+956 Bytes
...image_snapshots__/meter-screenshot-test-tsx-meter-media-linear-33-33-1-snap.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
+11.1 KB
(170%)
...ots__/private-skin-components-screenshot-test-tsx-components-in-blau-3-snap.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
+11.8 KB
(180%)
...e-skin-components-screenshot-test-tsx-components-in-blau-alternative-3-snap.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
+12.4 KB
(180%)
...ate-skin-components-screenshot-test-tsx-components-in-blau-dark-mode-3-snap.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
+11.7 KB
(180%)
...ivate-skin-components-screenshot-test-tsx-components-in-blau-inverse-3-snap.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
-144 Bytes
(100%)
...ivate-skin-components-screenshot-test-tsx-components-in-blau-inverse-4-snap.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
+12.5 KB
(180%)
...ponents-screenshot-test-tsx-components-in-blau-inverse-and-dark-mode-3-snap.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
+11.7 KB
(170%)
..._/private-skin-components-screenshot-test-tsx-components-in-movistar-3-snap.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
+11.4 KB
(170%)
...in-components-screenshot-test-tsx-components-in-movistar-alternative-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+13 KB
(180%)
...skin-components-screenshot-test-tsx-components-in-movistar-dark-mode-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12 KB
(180%)
...e-skin-components-screenshot-test-tsx-components-in-movistar-inverse-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+13.1 KB
(180%)
...nts-screenshot-test-tsx-components-in-movistar-inverse-and-dark-mode-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+11.5 KB
(170%)
...hots__/private-skin-components-screenshot-test-tsx-components-in-o-2-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+11.8 KB
(180%)
...te-skin-components-screenshot-test-tsx-components-in-o-2-alternative-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12.8 KB
(180%)
...vate-skin-components-screenshot-test-tsx-components-in-o-2-dark-mode-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+13.1 KB
(190%)
...rivate-skin-components-screenshot-test-tsx-components-in-o-2-inverse-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12.9 KB
(180%)
...mponents-screenshot-test-tsx-components-in-o-2-inverse-and-dark-mode-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+11.1 KB
(170%)
...__/private-skin-components-screenshot-test-tsx-components-in-o-2-new-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+11.7 KB
(170%)
...kin-components-screenshot-test-tsx-components-in-o-2-new-alternative-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12.6 KB
(180%)
...-skin-components-screenshot-test-tsx-components-in-o-2-new-dark-mode-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+61 Bytes
(100%)
...te-skin-components-screenshot-test-tsx-components-in-o-2-new-inverse-2-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12.8 KB
(180%)
...te-skin-components-screenshot-test-tsx-components-in-o-2-new-inverse-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
-185 Bytes
(100%)
...te-skin-components-screenshot-test-tsx-components-in-o-2-new-inverse-4-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12.7 KB
(180%)
...ents-screenshot-test-tsx-components-in-o-2-new-inverse-and-dark-mode-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+11.5 KB
(180%)
...private-skin-components-screenshot-test-tsx-components-in-telefonica-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+11.4 KB
(180%)
...-components-screenshot-test-tsx-components-in-telefonica-alternative-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12.3 KB
(180%)
...in-components-screenshot-test-tsx-components-in-telefonica-dark-mode-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+11.5 KB
(180%)
...skin-components-screenshot-test-tsx-components-in-telefonica-inverse-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12.4 KB
(180%)
...s-screenshot-test-tsx-components-in-telefonica-inverse-and-dark-mode-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12.4 KB
(180%)
...shots__/private-skin-components-screenshot-test-tsx-components-in-tu-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12.1 KB
(170%)
...ate-skin-components-screenshot-test-tsx-components-in-tu-alternative-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+13.1 KB
(180%)
...ivate-skin-components-screenshot-test-tsx-components-in-tu-dark-mode-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+13.5 KB
(180%)
...private-skin-components-screenshot-test-tsx-components-in-tu-inverse-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+13.3 KB
(180%)
...omponents-screenshot-test-tsx-components-in-tu-inverse-and-dark-mode-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+11.5 KB
(170%)
..._/private-skin-components-screenshot-test-tsx-components-in-vivo-new-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+11.7 KB
(170%)
...in-components-screenshot-test-tsx-components-in-vivo-new-alternative-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12.6 KB
(180%)
...skin-components-screenshot-test-tsx-components-in-vivo-new-dark-mode-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+13.7 KB
(190%)
...e-skin-components-screenshot-test-tsx-components-in-vivo-new-inverse-3-snap.png
Oops, something went wrong.
Binary file modified
BIN
+12.6 KB
(180%)
...nts-screenshot-test-tsx-components-in-vivo-new-inverse-and-dark-mode-3-snap.png
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,44 @@ | ||
import {openStoryPage, screen} from '../test-utils'; | ||
|
||
test.each` | ||
values | type | themeVariant | ||
${[0]} | ${'linear'} | ${'default'} | ||
${[0]} | ${'circular'} | ${'default'} | ||
${[0]} | ${'angular'} | ${'default'} | ||
${[100]} | ${'linear'} | ${'default'} | ||
${[100]} | ${'circular'} | ${'default'} | ||
${[100]} | ${'angular'} | ${'default'} | ||
${[33, 33]} | ${'linear'} | ${'default'} | ||
${[33, 33]} | ${'circular'} | ${'default'} | ||
${[33, 33]} | ${'angular'} | ${'default'} | ||
${[33, 33]} | ${'linear'} | ${'inverse'} | ||
${[33, 33]} | ${'circular'} | ${'inverse'} | ||
${[33, 33]} | ${'angular'} | ${'inverse'} | ||
${[33, 33]} | ${'linear'} | ${'media'} | ||
${[33, 33]} | ${'circular'} | ${'media'} | ||
${[33, 33]} | ${'angular'} | ${'media'} | ||
${[20, 20, 20, 20, 0]} | ${'linear'} | ${'default'} | ||
${[20, 20, 20, 20, 0]} | ${'circular'} | ${'default'} | ||
${[20, 20, 20, 20, 0]} | ${'angular'} | ${'default'} | ||
`('Meter $themeVariant $type $values', async ({themeVariant, values, type}) => { | ||
await openStoryPage({ | ||
id: 'components-data-visualizations-meter--meter-story', | ||
args: { | ||
themeVariant, | ||
width: 200, | ||
type, | ||
valuesCount: values.length, | ||
...values.reduce( | ||
(acc: Array<number>, value: number, index: number) => ({ | ||
...acc, | ||
[`value${index + 1}`]: value, | ||
}), | ||
{} | ||
), | ||
}, | ||
}); | ||
|
||
const stepper = await screen.findByTestId('Meter'); | ||
const image = await stepper.screenshot(); | ||
expect(image).toMatchImageSnapshot(); | ||
}); |
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,127 @@ | ||
import * as React from 'react'; | ||
import {Box, Meter, ResponsiveLayout} from '..'; | ||
import beachImg from './images/beach.jpg'; | ||
|
||
import type {MeterType} from '../meter'; | ||
|
||
export default { | ||
title: 'Components/Data Visualizations/Meter', | ||
argTypes: { | ||
type: { | ||
options: ['angular', 'circular', 'linear'] as Array<MeterType>, | ||
control: {type: 'select'}, | ||
}, | ||
themeVariant: { | ||
options: ['default', 'inverse', 'media'], | ||
control: {type: 'select'}, | ||
}, | ||
valuesCount: { | ||
control: {type: 'range', min: 1, max: 8, step: 1}, | ||
}, | ||
fullWidth: { | ||
control: {type: 'boolean'}, | ||
}, | ||
width: { | ||
if: {arg: 'fullWidth', eq: false}, | ||
control: {type: 'range', min: 64, max: 600, step: 1}, | ||
}, | ||
value1: { | ||
control: {type: 'range', min: 0, max: 100, step: 1}, | ||
}, | ||
value2: { | ||
control: {type: 'range', min: 0, max: 100, step: 1}, | ||
}, | ||
value3: { | ||
control: {type: 'range', min: 0, max: 100, step: 1}, | ||
}, | ||
value4: { | ||
control: {type: 'range', min: 0, max: 100, step: 1}, | ||
}, | ||
value5: { | ||
control: {type: 'range', min: 0, max: 100, step: 1}, | ||
}, | ||
value6: { | ||
control: {type: 'range', min: 0, max: 100, step: 1}, | ||
}, | ||
value7: { | ||
control: {type: 'range', min: 0, max: 100, step: 1}, | ||
}, | ||
value8: { | ||
control: {type: 'range', min: 0, max: 100, step: 1}, | ||
}, | ||
}, | ||
parameters: { | ||
fullScreen: true, | ||
}, | ||
}; | ||
|
||
type MeterStoryArgs = { | ||
type: MeterType; | ||
reverse: boolean; | ||
ariaLabel: string; | ||
themeVariant: 'default' | 'inverse' | 'media'; | ||
fullWidth: boolean; | ||
width: number; | ||
valuesCount: number; | ||
value1: number; | ||
value2: number; | ||
value3: number; | ||
value4: number; | ||
value5: number; | ||
value6: number; | ||
value7: number; | ||
value8: number; | ||
}; | ||
|
||
export const MeterStory: StoryComponent<MeterStoryArgs> = ({ | ||
type, | ||
reverse, | ||
themeVariant, | ||
valuesCount, | ||
fullWidth, | ||
width, | ||
ariaLabel, | ||
...valuesArgs | ||
}) => { | ||
const values = Object.values(valuesArgs).slice(0, valuesCount); | ||
return ( | ||
<div | ||
style={{ | ||
backgroundImage: themeVariant === 'media' ? `url(${beachImg})` : '', | ||
backgroundPosition: 'center', | ||
backgroundSize: 'cover', | ||
}} | ||
> | ||
<ResponsiveLayout variant={themeVariant} fullWidth> | ||
<Box padding={16}> | ||
<Meter | ||
aria-label={ariaLabel || undefined} | ||
type={type} | ||
reverse={reverse} | ||
values={values} | ||
width={fullWidth ? '100%' : width} | ||
/> | ||
</Box> | ||
</ResponsiveLayout> | ||
</div> | ||
); | ||
}; | ||
|
||
MeterStory.storyName = 'Meter'; | ||
MeterStory.args = { | ||
type: 'angular', | ||
reverse: false, | ||
ariaLabel: 'Meter example', | ||
themeVariant: 'default', | ||
fullWidth: false, | ||
width: 400, | ||
valuesCount: 8, | ||
value1: 10, | ||
value2: 10, | ||
value3: 10, | ||
value4: 10, | ||
value5: 10, | ||
value6: 10, | ||
value7: 10, | ||
value8: 10, | ||
}; |
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,30 @@ | ||
import * as React from 'react'; | ||
import {screen, render} from '@testing-library/react'; | ||
import ThemeContextProvider from '../theme-context-provider'; | ||
import {makeTheme} from './test-utils'; | ||
import Meter from '../meter'; | ||
|
||
test('Meter custom label', () => { | ||
render( | ||
<ThemeContextProvider theme={makeTheme()}> | ||
<Meter aria-label="Patata" values={[10, 20, 30]} /> | ||
</ThemeContextProvider> | ||
); | ||
|
||
const meter = screen.getByRole('meter', {name: 'Patata'}); | ||
expect(meter).toBeInTheDocument(); | ||
}); | ||
|
||
test('Meter default label', () => { | ||
render( | ||
<ThemeContextProvider theme={makeTheme()}> | ||
<Meter values={[10, 20, 30]} /> | ||
</ThemeContextProvider> | ||
); | ||
|
||
const expectedLabel = | ||
'Indicador de progreso con 3 secciones, total 60% de 100%. Sección 1: 10%. Sección 2: 20%. Sección 3: 30%'; | ||
|
||
const meter = screen.getByRole('meter', {name: expectedLabel}); | ||
expect(meter).toBeInTheDocument(); | ||
}); |
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
Oops, something went wrong.