@@ -12,7 +12,7 @@ public function testCheckTrue()
1212 'backgroundColor ' => '#ffffff ' ,
1313 'textColor ' => '#2D3B45 '
1414 ];
15-
15+
1616 $ rule = new CssTextStyleEmphasize ($ dom , $ options );
1717
1818 $ this ->assertEquals (0 , $ rule ->check (), 'Css Text Style Emphasize should have no issues. ' );
@@ -27,13 +27,13 @@ public function testCheckFalse()
2727 'backgroundColor ' => '#ffffff ' ,
2828 'textColor ' => '#2D3B45 '
2929 ];
30-
30+
3131 $ rule = new CssTextStyleEmphasize ($ dom , $ options );
3232
3333 $ this ->assertEquals (1 , $ rule ->check (), 'Css Text Style Emphasize should have two issues. ' );
3434 }
3535
36- public function testCheckBackgroundAttributeColorNamePass ()
36+ public function testCheckBackgroundAttributeColorNamePass ()
3737 {
3838 $ html = $ this ->getGoodBackgroundContrastColorNameHtml ();
3939 $ dom = new \DOMDocument ('1.0 ' , 'utf-8 ' );
@@ -42,9 +42,55 @@ public function testCheckBackgroundAttributeColorNamePass()
4242 'backgroundColor ' => '#ffffff ' ,
4343 'textColor ' => '#2D3B45 '
4444 ];
45-
45+
46+ $ rule = new CssTextStyleEmphasize ($ dom , $ options );
47+
48+ $ this ->assertEquals (0 , $ rule ->check (), 'CSS Text Style Emphasize should have no issues. ' );
49+ }
50+
51+ public function testCompletelyColoredHeader ()
52+ {
53+ $ html = '<h2><span style="color: #008000;">This is a heading with color applied</span></h2> ' ;
54+ $ dom = new \DOMDocument ('1.0 ' , 'utf-8 ' );
55+ $ dom ->loadHTML ($ html );
56+ $ options = [
57+ 'backgroundColor ' => '#ffffff ' ,
58+ 'textColor ' => '#2D3B45 '
59+ ];
60+
61+ $ rule = new CssTextStyleEmphasize ($ dom , $ options );
62+
63+ $ this ->assertEquals (0 , $ rule ->check (), 'CSS Text Style Emphasize should have no issues. ' );
64+ }
65+
66+ public function testPartiallyColoredHeader ()
67+ {
68+ $ html = '<h2>This is a <span style="color: #008000;">heading</span> with only some color applied</h2> ' ;
69+ $ dom = new \DOMDocument ('1.0 ' , 'utf-8 ' );
70+ $ dom ->loadHTML ($ html );
71+ $ options = [
72+ 'backgroundColor ' => '#ffffff ' ,
73+ 'textColor ' => '#2D3B45 '
74+ ];
75+
76+ $ rule = new CssTextStyleEmphasize ($ dom , $ options );
77+
78+ $ this ->assertEquals (1 , $ rule ->check (), 'CSS Text Style Emphasize should have one issue. ' );
79+ }
80+
81+ public function testNestedDifferentColorInHeader ()
82+ {
83+ $ html = '<h2><span style="color: #008000;">This is a heading with <span style="color: #3366ff;">two colors</span> applied</span></h2> ' ;
84+ $ dom = new \DOMDocument ('1.0 ' , 'utf-8 ' );
85+ $ dom ->loadHTML ($ html );
86+ $ options = [
87+ 'backgroundColor ' => '#ffffff ' ,
88+ 'textColor ' => '#2D3B45 '
89+ ];
90+
4691 $ rule = new CssTextStyleEmphasize ($ dom , $ options );
4792
48- $ this ->assertEquals (0 , $ rule ->check (), 'CSS Text Has Contrast should have no issues . ' );
93+ $ this ->assertEquals (1 , $ rule ->check (), 'CSS Text Style Emphasize should have one issue . ' );
4994 }
50- }
95+
96+ }
0 commit comments