|
| 1 | +import assert from 'assert'; |
| 2 | +import fs from 'fs'; |
| 3 | +import path from 'path'; |
| 4 | + |
| 5 | +const css = fs.readFileSync( |
| 6 | + path.resolve(path.dirname(new URL(import.meta.url).pathname), '../../../css/flex-utils.css'), |
| 7 | + 'utf8' |
| 8 | +); |
| 9 | + |
| 10 | +// Align Self |
| 11 | +// ------------------------------------------------------------ |
| 12 | + |
| 13 | +const ALIGN_SELF_VALUES = [ |
| 14 | + 'start', |
| 15 | + 'end', |
| 16 | + 'center', |
| 17 | + 'stretch', |
| 18 | + 'baseline', |
| 19 | + 'auto' |
| 20 | +]; |
| 21 | + |
| 22 | +for (const value of ALIGN_SELF_VALUES) { |
| 23 | + assert( |
| 24 | + css.includes(`.ion-align-self-${value}`), |
| 25 | + `CSS should include .ion-align-self-${value} class` |
| 26 | + ); |
| 27 | +} |
| 28 | + |
| 29 | +// Flex Wrap |
| 30 | +// ------------------------------------------------------------ |
| 31 | + |
| 32 | +const FLEX_WRAP_VALUES = [ |
| 33 | + 'wrap', |
| 34 | + 'nowrap', |
| 35 | + 'wrap-reverse' |
| 36 | +]; |
| 37 | + |
| 38 | +for (const value of FLEX_WRAP_VALUES) { |
| 39 | + assert( |
| 40 | + css.includes(`.ion-${value}`), |
| 41 | + `CSS should include .ion-${value} class` |
| 42 | + ); |
| 43 | +} |
| 44 | + |
| 45 | +// Justify Content |
| 46 | +// ------------------------------------------------------------ |
| 47 | + |
| 48 | +const JUSTIFY_CONTENT_VALUES = [ |
| 49 | + 'start', |
| 50 | + 'center', |
| 51 | + 'end', |
| 52 | + 'around', |
| 53 | + 'between', |
| 54 | + 'evenly' |
| 55 | +]; |
| 56 | + |
| 57 | +for (const value of JUSTIFY_CONTENT_VALUES) { |
| 58 | + assert( |
| 59 | + css.includes(`.ion-justify-content-${value}`), |
| 60 | + `CSS should include .ion-justify-content-${value} class` |
| 61 | + ); |
| 62 | +} |
| 63 | + |
| 64 | +// Align Items |
| 65 | +// ------------------------------------------------------------ |
| 66 | + |
| 67 | +const ALIGN_ITEMS_VALUES = [ |
| 68 | + 'start', |
| 69 | + 'center', |
| 70 | + 'end', |
| 71 | + 'stretch', |
| 72 | + 'baseline' |
| 73 | +]; |
| 74 | + |
| 75 | +for (const value of ALIGN_ITEMS_VALUES) { |
| 76 | + assert( |
| 77 | + css.includes(`.ion-align-items-${value}`), |
| 78 | + `CSS should include .ion-align-items-${value} class` |
| 79 | + ); |
| 80 | +} |
| 81 | + |
| 82 | +console.log("All flex-utils.css tests pass."); |
0 commit comments