|
| 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 | +}); |
0 commit comments