Skip to content

Commit 6fd50a8

Browse files
committed
Revert "remove css ionic theme tests"
This reverts commit bee6003.
1 parent 081c463 commit 6fd50a8

25 files changed

+445
-0
lines changed

core/src/css/test/display.e2e.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { test, expect } from '@playwright/test';
2+
import fs from 'fs';
3+
import path from 'path';
4+
5+
test.describe('display css utility classes', () => {
6+
let css: string;
7+
8+
test.beforeAll(() => {
9+
css = fs.readFileSync(path.resolve(__dirname, '../../../css/display.css'), 'utf8');
10+
});
11+
12+
const INFIXES = ['', '-sm', '-md', '-lg', '-xl'];
13+
14+
// TODO(FW-6697): remove `ion-hide classes` test
15+
test('ion-hide classes', () => {
16+
expect(css).toContain('.ion-hide');
17+
18+
const values = ['up', 'down'];
19+
20+
for (const value of values) {
21+
for (const infix of INFIXES) {
22+
expect(css).toContain(`.ion-hide${infix}-${value}`);
23+
}
24+
}
25+
});
26+
27+
test('ion-display classes', () => {
28+
const values = [
29+
'none',
30+
'inline',
31+
'inline-block',
32+
'block',
33+
'flex',
34+
'inline-flex',
35+
'grid',
36+
'inline-grid',
37+
'table',
38+
'table-cell',
39+
'table-row',
40+
];
41+
42+
for (const value of values) {
43+
for (const infix of INFIXES) {
44+
expect(css).toContain(`.ion-display${infix}-${value}`);
45+
}
46+
}
47+
});
48+
});
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import { test, expect } from '@playwright/test';
2+
import fs from 'fs';
3+
import path from 'path';
4+
5+
test.describe('flex-utils css utility classes', () => {
6+
let css: string;
7+
8+
test.beforeAll(() => {
9+
css = fs.readFileSync(path.resolve(__dirname, '../../../css/flex-utils.css'), 'utf8');
10+
});
11+
12+
const INFIXES = ['', '-sm', '-md', '-lg', '-xl'];
13+
14+
test('align-content classes', () => {
15+
const values = ['start', 'end', 'center', 'between', 'around', 'stretch'];
16+
for (const value of values) {
17+
for (const infix of INFIXES) {
18+
expect(css).toContain(`.ion-align-content${infix}-${value}`);
19+
}
20+
}
21+
});
22+
23+
test('align-items classes', () => {
24+
const values = ['start', 'center', 'end', 'stretch', 'baseline'];
25+
for (const value of values) {
26+
for (const infix of INFIXES) {
27+
expect(css).toContain(`.ion-align-items${infix}-${value}`);
28+
}
29+
}
30+
});
31+
32+
test('align-self classes', () => {
33+
const values = ['start', 'end', 'center', 'stretch', 'baseline', 'auto'];
34+
for (const value of values) {
35+
for (const infix of INFIXES) {
36+
expect(css).toContain(`.ion-align-self${infix}-${value}`);
37+
}
38+
}
39+
});
40+
41+
test('justify-content classes', () => {
42+
const values = ['start', 'center', 'end', 'around', 'between', 'evenly'];
43+
for (const value of values) {
44+
for (const infix of INFIXES) {
45+
expect(css).toContain(`.ion-justify-content${infix}-${value}`);
46+
}
47+
}
48+
});
49+
50+
test('flex-direction classes', () => {
51+
const values = ['row', 'row-reverse', 'column', 'column-reverse'];
52+
for (const value of values) {
53+
for (const infix of INFIXES) {
54+
expect(css).toContain(`.ion-flex${infix}-${value}`);
55+
}
56+
}
57+
});
58+
59+
test('flex-wrap classes', () => {
60+
const values = ['wrap', 'nowrap', 'wrap-reverse'];
61+
// TODO(FW-6697): remove all `ion-wrap-*` expects
62+
for (const value of values) {
63+
expect(css).toContain(`.ion-${value}`);
64+
}
65+
for (const value of values) {
66+
for (const infix of INFIXES) {
67+
expect(css).toContain(`.ion-flex${infix}-${value}`);
68+
}
69+
}
70+
});
71+
72+
test('flex-fill classes', () => {
73+
const values = ['1', 'auto', 'initial', 'none'];
74+
for (const value of values) {
75+
for (const infix of INFIXES) {
76+
expect(css).toContain(`.ion-flex${infix}-${value}`);
77+
}
78+
}
79+
});
80+
81+
test('flex-grow and flex-shrink classes', () => {
82+
const values = ['grow', 'shrink'];
83+
for (const value of values) {
84+
for (const infix of INFIXES) {
85+
expect(css).toContain(`.ion-flex${infix}-${value}-0`);
86+
expect(css).toContain(`.ion-flex${infix}-${value}-1`);
87+
}
88+
}
89+
});
90+
91+
test('flex-order classes', () => {
92+
for (const infix of INFIXES) {
93+
expect(css).toContain(`.ion-order${infix}-first`);
94+
expect(css).toContain(`.ion-order${infix}-last`);
95+
for (let i = 0; i <= 12; i++) {
96+
expect(css).toContain(`.ion-order${infix}-${i}`);
97+
}
98+
}
99+
});
100+
});
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<!DOCTYPE html>
2+
<html lang="en" dir="ltr">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>Link - Basic</title>
6+
<meta
7+
name="viewport"
8+
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
9+
/>
10+
<link href="../../../../../css/ionic/bundle.ionic.css" rel="stylesheet" />
11+
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
12+
<script src="../../../../../scripts/testing/scripts.js"></script>
13+
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
14+
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
15+
<style>
16+
.links div {
17+
padding: 8px;
18+
}
19+
</style>
20+
</head>
21+
22+
<body>
23+
<ion-app>
24+
<ion-header>
25+
<ion-toolbar>
26+
<ion-title>Link - Basic</ion-title>
27+
</ion-toolbar>
28+
</ion-header>
29+
30+
<ion-content class="ionic-padding-space-m">
31+
<h3>Standalone (.ion-link)</h3>
32+
<div class="links" id="standalone">
33+
<div><a href="#test-visited-link">Link - Default</a></div>
34+
<div><a class="ion-activated" href="#">Link - Active</a></div>
35+
<div><a class="ion-focused" href="#">Link - Focused</a></div>
36+
<div><a href="">Link - Visited</a></div>
37+
<div>
38+
<a href="#">Link with Icon <ion-icon name="open-outline"></ion-icon></a>
39+
</div>
40+
</div>
41+
42+
<h3>Underline (.ion-link-underline)</h3>
43+
<div class="links" id="underline">
44+
<div><a class="ion-link-underline" href="#test-visited-link">Underline - Default</a></div>
45+
<div><a class="ion-link-underline ion-activated" href="#">Underline - Active</a></div>
46+
<div><a class="ion-link-underline ion-focused" href="#">Underline - Focused</a></div>
47+
<div><a class="ion-link-underline" href="">Underline - Visited</a></div>
48+
<div>
49+
<a class="ion-link-underline" href="#">Link with Icon <ion-icon name="open-outline"></ion-icon></a>
50+
</div>
51+
</div>
52+
53+
<h3>Links in Content</h3>
54+
<div class="links" id="links-in-content">
55+
<div>
56+
Lorem ipsum dolor sit amet consectetur, <a class="ion-link" href="#">default link</a> adipisicing elit.
57+
</div>
58+
<div>
59+
Lorem ipsum dolor sit amet consectetur,
60+
<a class="ion-link-underline" href="#">underline link</a> adipisicing elit.
61+
</div>
62+
</div>
63+
64+
<h3>Parent Element</h3>
65+
<div class="links">
66+
<div class="ion-link" id="standalone-nested">
67+
<p>Lorem ipsum dolor sit amet consectetur, <a href="#">default link</a> adipisicing elit.</p>
68+
</div>
69+
<div class="ion-link-underline" id="underline-nested">
70+
<p>Lorem ipsum dolor sit amet consectetur, <a href="#">underline link</a> adipisicing elit.</p>
71+
</div>
72+
</div>
73+
</ion-content>
74+
</ion-app>
75+
</body>
76+
</html>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { expect } from '@playwright/test';
2+
import { configs, test } from '@utils/test/playwright';
3+
4+
/**
5+
* Link global classes are only available in the Ionic theme.
6+
*/
7+
configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
8+
test.describe(title('link global classes'), () => {
9+
test.beforeEach(async ({ page }) => {
10+
await page.goto('/src/css/test/link/basic/index.html', config);
11+
});
12+
13+
test.describe('.ion-link class', () => {
14+
test('should apply to anchor elements', async ({ page }) => {
15+
const standalone = page.locator('#standalone');
16+
17+
await expect(standalone).toHaveScreenshot(screenshot('link-standalone'));
18+
});
19+
20+
test('should apply to child anchor elements', async ({ page }) => {
21+
const standalone = page.locator('#standalone-nested');
22+
23+
await expect(standalone).toHaveScreenshot(screenshot('link-standalone-nested'));
24+
});
25+
});
26+
27+
test.describe('.ion-link-underline class', () => {
28+
test('should apply to anchor elements', async ({ page }) => {
29+
const standalone = page.locator('#underline');
30+
31+
await expect(standalone).toHaveScreenshot(screenshot('link-underline'));
32+
});
33+
34+
test('should apply to child anchor elements', async ({ page }) => {
35+
const standalone = page.locator('#underline-nested');
36+
37+
await expect(standalone).toHaveScreenshot(screenshot('link-underline-nested'));
38+
});
39+
});
40+
});
41+
});
7.12 KB
Loading
10.3 KB
Loading
8.54 KB
Loading
4.54 KB
Loading
6.47 KB
Loading
7.22 KB
Loading

0 commit comments

Comments
 (0)