Appearance
@obewds/vue-component-helpers Tests
Testing Status
CURRENT STATUS
100% Coverage
100% Passing
Vitest Tests
extract-valid-palettes.test.js
js
// ./tests/extract-valid-palettes.test.js
import { extractValidPalettes } from '../src/index'
import { ObewdsTwConfig } from '@obewds/obewds-tw-config'
/*
test('extractValidPalettes helper returns an expected array of anchor palette name strings from the default ObewdsTwConfig config data', async () => {
const extracted = extractValidPalettes(ObewdsTwConfig, 'anchor')
extracted.forEach( (value) => {
expect(ObewdsTwConfig.text.palettes[anchor]).toBeDefined()
})
})
*/
test('extractValidPalettes helper returns an expected array of bg palette name strings from the default ObewdsTwConfig config data', async () => {
const extracted = extractValidPalettes(ObewdsTwConfig, 'bg')
extracted.forEach( (value) => {
expect(ObewdsTwConfig.bg.palettes[value]).toBeDefined()
})
})
test('extractValidPalettes helper returns an expected array of border palette name strings from the default ObewdsTwConfig config data', async () => {
const extracted = extractValidPalettes(ObewdsTwConfig, 'border')
extracted.forEach( (value) => {
expect(ObewdsTwConfig.border.palettes[value]).toBeDefined()
})
})
test('extractValidPalettes helper returns an expected array of text palette name strings from the default ObewdsTwConfig config data', async () => {
const extracted = extractValidPalettes(ObewdsTwConfig, 'text')
extracted.forEach( (value) => {
expect(ObewdsTwConfig.text.palettes[value]).toBeDefined()
})
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
get-bg-palette-color.test.js
js
// ./tests/get-bg-palette-color.test.js
import { getBgPaletteColor } from '../src/index'
import { ObewdsTwConfig } from '@obewds/obewds-tw-config'
test('getBgPaletteColor helper returns an expected default palette primary string', async () => {
const extracted = getBgPaletteColor(ObewdsTwConfig, 'default', 'primary')
const initial = ObewdsTwConfig.bg.palettes.default.colors.primary
expect(extracted).toBe(initial)
})
test('getBgPaletteColor helper returns an empty string if passed an empty config object', async () => {
const extracted = getBgPaletteColor({}, 'default', 'primary')
expect(extracted).toEqual('')
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
get-border-palette-color.test.js
js
// ./tests/get-border-palette-color.test.js
import { getBorderPaletteColor } from '../src/index'
import { ObewdsTwConfig } from '@obewds/obewds-tw-config'
test('getBorderPaletteColor helper returns an expected default palette primary string', async () => {
const extracted = getBorderPaletteColor(ObewdsTwConfig, 'default', 'primary')
const initial = ObewdsTwConfig.border.palettes.default.colors.primary
expect(extracted).toBe(initial)
})
test('getBorderPaletteColor helper returns an empty string if passed an empty config object', async () => {
const extracted = getBorderPaletteColor({}, 'default', 'primary')
expect(extracted).toEqual('')
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
get-text-palette-color.test.js
js
// ./tests/get-text-palette-color.test.js
import { getTextPaletteColor } from '../src/index'
import { ObewdsTwConfig } from '@obewds/obewds-tw-config'
test('getTextPaletteColor helper returns an expected default palette primary string', async () => {
const extracted = getTextPaletteColor(ObewdsTwConfig, 'default', 'primary')
const initial = ObewdsTwConfig.text.palettes.default.colors.primary
expect(extracted).toBe(initial)
})
test('getTextPaletteColor helper returns an empty string if passed an empty config object', async () => {
const extracted = getTextPaletteColor({}, 'default', 'primary')
expect(extracted).toEqual('')
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
is-empty-element.test.js
js
// ./tests/is-empty-element.test.js
import { blockLevelElementTags } from '@obewds/vue-validators'
import { emptyElementTags } from '@obewds/vue-validators'
import { inlineLevelElementTags } from '@obewds/vue-validators'
import { isEmptyElement } from '../src/index'
test('isEmptyElement helper returns true for all empty element tags', async () => {
emptyElementTags.forEach( (tag) => {
const isEmptyEl = isEmptyElement(tag)
expect(isEmptyEl).toBeTruthy()
})
})
test('isEmptyElement helper returns false for all block level element tags', async () => {
blockLevelElementTags.forEach( (tag) => {
const isEmptyEl = isEmptyElement(tag)
expect(isEmptyEl).toBe(false)
})
})
test('isEmptyElement helper returns false for all inline level element tags', async () => {
inlineLevelElementTags.forEach( (tag) => {
const isEmptyEl = isEmptyElement(tag)
expect(isEmptyEl).toBe(false)
})
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
is-empty-or-unsupported-element.test.js
js
// ./tests/is-empty-or-unsupported-element.test.js
import { blockLevelElementTags } from '@obewds/vue-validators'
import { emptyElementTags } from '@obewds/vue-validators'
import { inlineLevelElementTags } from '@obewds/vue-validators'
import { isEmptyOrUnsupportedElement } from '../src/index'
import { unsupportedElementTags } from '@obewds/vue-validators'
test('isEmptyOrUnsupportedElement helper returns true for all empty & unsupported element tags', async () => {
emptyElementTags.forEach( (tag) => {
const isEmptyOrUnsupportedEl = isEmptyOrUnsupportedElement(tag)
expect(isEmptyOrUnsupportedEl).toBeTruthy()
})
unsupportedElementTags.forEach( (tag) => {
const isEmptyOrUnsupportedEl = isEmptyOrUnsupportedElement(tag)
expect(isEmptyOrUnsupportedEl).toBeTruthy()
})
})
test('isEmptyOrUnsupportedElement helper returns false for all block and inline level element tags', async () => {
blockLevelElementTags.forEach( (tag) => {
const isEmptyOrUnsupportedEl = isEmptyOrUnsupportedElement(tag)
expect(isEmptyOrUnsupportedEl).toBe(false)
})
inlineLevelElementTags.forEach( (tag) => {
const isEmptyOrUnsupportedEl = isEmptyOrUnsupportedElement(tag)
expect(isEmptyOrUnsupportedEl).toBe(false)
})
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
is-unsupported-element.test.js
js
// ./tests/is-unsupported-element.test.js
import { blockLevelElementTags } from '@obewds/vue-validators'
import { emptyElementTags } from '@obewds/vue-validators'
import { inlineLevelElementTags } from '@obewds/vue-validators'
import { isUnsupportedElement } from '../src/index'
import { unsupportedElementTags } from '@obewds/vue-validators'
test('isUnsupportedElement helper returns true for all unsupported element tags', async () => {
unsupportedElementTags.forEach( (tag) => {
const isUnsupportedEl = isUnsupportedElement(tag)
expect(isUnsupportedEl).toBeTruthy()
})
})
test('isUnsupportedElement helper returns false for all block level element tags', async () => {
blockLevelElementTags.forEach( (tag) => {
const isUnsupportedEl = isUnsupportedElement(tag)
expect(isUnsupportedEl).toBe(false)
})
})
test('isUnsupportedElement helper returns false for all inline level element tags', async () => {
inlineLevelElementTags.forEach( (tag) => {
const isUnsupportedEl = isUnsupportedElement(tag)
expect(isUnsupportedEl).toBe(false)
})
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40