-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.scss
60 lines (55 loc) · 1.72 KB
/
test.scss
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
52
53
54
55
56
57
58
59
60
@use './apca';
@use 'sass:list';
// https://github.com/Myndex/SAPC-APCA/tree/master/documentation
//
// Test Values for APCA W3 using the G series constants, normal and reverse float values for each color pair.
// First number is TEXT second number is BACKGROUND.
//
// TEXT vs BKGND • EXPECTED RESULT for APCA W3 to 0.1.9 (G-constants)
//
// #888 vs #fff • 63.056469930209424
// #fff vs #888 • -68.54146436644962
//
// #000 vs #aaa • 58.146262578561334
// #aaa vs #000 • -56.24113336839742
//
// #123 vs #def • 91.66830811481631
// #def vs #123 • -93.06770049484275
//
// #123 vs #444 • 8.32326136957393
// #444 vs #123 • -7.526878460278154
//
// The below are only for certain experimental low-scale versions, these tests do *not* acpa-w3:
//
// #123 vs #234 • 1.7512243099356113
// #234 vs #123 • -1.6349191031377903
$contrast-tests: (
(#888, #fff, 63.056469930209424),
(#fff, #888, -68.54146436644962),
(#000, #aaa, 58.146262578561334),
(#aaa, #000, -56.24113336839742),
(#123, #def, 91.66830811481631),
(#def, #123, -93.06770049484275),
(#123, #444, 8.32326136957393),
(#444, #123, -7.526878460278154),
(#123, #234, 0),
(#234, #123, 0)
);
@each $txt, $bg, $contrast in $contrast-tests {
$res: apca.contrast($txt, $bg);
@if ($res != $contrast) {
@error "apca.contrast(#{$txt}, #{$bg}) should be #{$contrast} but received #{$res}";
}
}
$recommendation-tests: (
(#fff, black),
(#000, white),
(#fc0, black),
(#2c911c, white)
);
@each $bg, $txt in $recommendation-tests {
$c: apca.recommend-text-color($bg);
@if ($c != $txt) {
@error "apca.recommend-text-color(#{$bg}) should be #{$txt} but received #{$c}";
}
}