File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
tests/AdvancedHTMLParserTests Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,33 @@ def test_createStyleFromStyle(self):
108108
109109 assert item .style .paddingLeft != '11px' , 'Expected changes to the copy do not affect the original.'
110110
111+ def test_setStyleMethod (self ):
112+ tag = AdvancedHTMLParser .AdvancedTag ('div' )
113+
114+ tag .setStyle ('font-weight' , 'bold' )
115+
116+ assert tag .getStyle ('font-weight' ) == 'bold' , 'Expected setStyle to set style attribute (on tag.getStyle)'
117+
118+ assert tag .style .fontWeight == 'bold' , 'Expected setStyle to set style attribute (on tag.style)'
119+
120+ html = tag .outerHTML
121+
122+ assert 'font-weight: bold' in html , 'Expected style attribute to be set on tag in html'
123+
124+ def test_setStyleAttr (self ):
125+ tag = AdvancedHTMLParser .AdvancedTag ('div' )
126+
127+ tag .style .fontWeight = 'bold'
128+
129+ assert tag .getStyle ('font-weight' ) == 'bold' , 'Expected setStyle to set style attribute (on tag.getStyle)'
130+
131+ assert tag .style .fontWeight == 'bold' , 'Expected setStyle to set style attribute (on tag.style)'
132+
133+ html = tag .outerHTML
134+
135+ assert 'font-weight: bold' in html , 'Expected style attribute to be set on tag in html'
136+
137+
111138
112139
113140
You can’t perform that action at this time.
0 commit comments