Skip to content

Commit

Permalink
fix(core/typography): use text color value and add vrts (#1155)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuke-ellington authored Mar 13, 2024
1 parent b9fb01d commit 1672561
Show file tree
Hide file tree
Showing 14 changed files with 244 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/components/typography/typography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class IxTypography {

if (this.textColor) {
style = {
color: `var(--theme-color-${this.color}-text)`,
color: `var(--theme-color-${this.textColor}-text)`,
};
}

Expand Down
57 changes: 57 additions & 0 deletions packages/core/src/tests/typography/basic/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!--
SPDX-FileCopyrightText: 2023 Siemens AG
SPDX-License-Identifier: MIT
-->

<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"
/>
<title>Stencil Component Starter</title>
</head>
<body>
<script>
const textFormats = [
'label-lg',
'label',
'label-sm',
'label-xs',

'body-lg',
'body',
'body-sm',
'body-xs',

'display-xxl',
'display-xl',
'display-lg',
'display',
'display-sm',
'display-xs',

'h1',
'h2',
'h3',
'h4',
'h5',
'h6',

'code-lg',
'code',
'code-sm',
];

textFormats.map(format => {
const typography = document.createElement('ix-typography');
typography.format = format;
typography.innerHTML = format;
document.body.appendChild(typography);
});
</script>
<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script>
</body>
</html>
58 changes: 58 additions & 0 deletions packages/core/src/tests/typography/line-through/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!--
SPDX-FileCopyrightText: 2023 Siemens AG
SPDX-License-Identifier: MIT
-->

<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"
/>
<title>Stencil Component Starter</title>
</head>
<body>
<script>
const textFormats = [
'label-lg',
'label',
'label-sm',
'label-xs',

'body-lg',
'body',
'body-sm',
'body-xs',

'display-xxl',
'display-xl',
'display-lg',
'display',
'display-sm',
'display-xs',

'h1',
'h2',
'h3',
'h4',
'h5',
'h6',

'code-lg',
'code',
'code-sm',
];

textFormats.map(format => {
const typography = document.createElement('ix-typography');
typography.format = format;
typography.innerHTML = format;
typography.textDecoration = 'line-through';
document.body.appendChild(typography);
});
</script>
<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script>
</body>
</html>
37 changes: 37 additions & 0 deletions packages/core/src/tests/typography/text-color/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!--
SPDX-FileCopyrightText: 2023 Siemens AG
SPDX-License-Identifier: MIT
-->

<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"
/>
<title>Stencil Component Starter</title>
<style>
.inv-bg {
background-color: var(--theme-color-alarm);
}
</style>
</head>
<body>
<ix-typography text-color="contrast">Contrast</ix-typography>
<ix-typography text-color="std">Std</ix-typography>
<ix-typography text-color="soft">Soft</ix-typography>
<ix-typography text-color="weak">Weak</ix-typography>
<ix-typography text-color="alarm">Alarm</ix-typography>

<div class="inv-bg">
<ix-typography text-color="inv-contrast">Inv-contrast</ix-typography>
<ix-typography text-color="inv-std">Inv-std</ix-typography>
<ix-typography text-color="inv-soft">Inv-soft</ix-typography>
<ix-typography text-color="inv-weak">Inv-weak</ix-typography>
</div>

<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions packages/core/src/tests/typography/typography.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* SPDX-FileCopyrightText: 2023 Siemens AG
*
* SPDX-License-Identifier: MIT
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import { expect } from '@playwright/test';
import { regressionTest } from '@utils/test';

regressionTest.describe('typography', () => {
regressionTest('basic', async ({ page }) => {
await page.goto('typography/basic');
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});

regressionTest('line-through', async ({ page }) => {
await page.goto('typography/line-through');
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});

regressionTest('underline', async ({ page }) => {
await page.goto('typography/underline');
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});

regressionTest('text color', async ({ page }) => {
await page.goto('typography/text-color');
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions packages/core/src/tests/typography/underline/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!--
SPDX-FileCopyrightText: 2023 Siemens AG
SPDX-License-Identifier: MIT
-->

<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"
/>
<title>Stencil Component Starter</title>
</head>
<body>
<script>
const textFormats = [
'label-lg',
'label',
'label-sm',
'label-xs',

'body-lg',
'body',
'body-sm',
'body-xs',

'display-xxl',
'display-xl',
'display-lg',
'display',
'display-sm',
'display-xs',

'h1',
'h2',
'h3',
'h4',
'h5',
'h6',

'code-lg',
'code',
'code-sm',
];

textFormats.map(format => {
const typography = document.createElement('ix-typography');
typography.format = format;
typography.innerHTML = format;
typography.textDecoration = 'underline';
document.body.appendChild(typography);
});
</script>
<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script>
</body>
</html>

0 comments on commit 1672561

Please sign in to comment.