def test_feature_name(self): # No current compat pages raw = '{{htmlattrxref("style")}}' ks = HTMLAttrXRef( raw=raw, args=['style'], scope='compatibility feature') self.assertEqual(ks.to_html(), '<code>style</code>') self.assertFalse(ks.issues) self.assertEqual(text_type(ks), raw)
def test_footnote_with_element(self): # https://developer.mozilla.org/en-US/docs/Web/API/Element raw = '{{htmlattrxref("sandbox", "iframe")}}' ks = HTMLAttrXRef( raw=raw, args=['sandbox', 'iframe'], scope='footnote') self.assertEqual( ks.to_html(), ('<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/' 'Element/iframe#attr-sandbox"><code>sandbox</code></a>'))
def test_spec_desc_without_element(self): # https://developer.mozilla.org/en-US/docs/Web/API/Element/classList raw = '{{htmlattrxref("class")}}' ks = HTMLAttrXRef( raw=raw, args=['class'], scope='specification description') self.assertEqual( ks.to_html(), ('<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/' 'Global_attributes#attr-class"><code>class</code></a>'))