Skip to content

Commit 25e4d4b

Browse files
committed
Add failing style test
1 parent 8849721 commit 25e4d4b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/AdvancedHTMLParserTests/test_Style.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)