Пример #1
0
 def test_feature_name(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SIMD
     raw = '{{jsxref("Float32x4", "SIMD.Float32x4")}}'
     ks = JSxRef(
         raw=raw, args=['Float32x4', 'SIMD.Float32x4'],
         scope='compatibility feature')
     self.assertEqual(ks.to_html(), '<code>SIMD.Float32x4</code>')
Пример #2
0
 def test_feature_name(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SIMD
     raw = '{{jsxref("Float32x4", "SIMD.Float32x4")}}'
     ks = JSxRef(
         raw=raw, args=["Float32x4", "SIMD.Float32x4"],
         scope='compatibility feature')
     self.assertEqual(ks.to_html(), '<code>SIMD.Float32x4</code>')
Пример #3
0
 def test_global_object(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
     raw = '{{jsxref("Global_Objects/null", "null")}}'
     ks = JSxRef(
         raw=raw, args=['Global_Objects/null', 'null'],
         scope='specification description')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/null"><code>null</code></a>'))
Пример #4
0
 def test_footnote(self):
     # https://developer.mozilla.org/en-US/docs/Web/API/Blob
     raw = '{{jsxref("Array/slice", "Array.slice()")}}'
     ks = JSxRef(
         raw=raw, args=['Array/slice', 'Array.slice()'], scope='footnote')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/Array/slice"><code>Array.slice()'
          '</code></a>'))
Пример #5
0
 def test_global_object(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
     raw = '{{jsxref("Global_Objects/null", "null")}}'
     ks = JSxRef(
         raw=raw, args=["Global_Objects/null", "null"],
         scope='specification description')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/null"><code>null</code></a>'))
Пример #6
0
 def test_footnote(self):
     # https://developer.mozilla.org/en-US/docs/Web/API/Blob
     raw = '{{jsxref("Array/slice", "Array.slice()")}}'
     ks = JSxRef(
         raw=raw, args=["Array/slice", "Array.slice()"], scope='footnote')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/Array/slice"><code>Array.slice()'
          '</code></a>'))
Пример #7
0
 def test_dotted_function(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math
     raw = '{{jsxref("Math.log10()", "log10()")}}'
     ks = JSxRef(
         raw=raw, args=['Math.log10()', 'log10()'],
         scope='specification description')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/Math/log10"><code>log10()'
          '</code></a>'))
Пример #8
0
 def test_prototype(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
     raw = '{{jsxref("Array.prototype.lastIndexOf", "lastIndexOf")}}'
     ks = JSxRef(
         raw=raw, args=['Array.prototype.lastIndexOf', 'lastIndexOf'],
         scope='specification description')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/Array/lastIndexOf"><code>lastIndexOf'
          '</code></a>'))
Пример #9
0
 def test_display_name(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/arguments
     raw = '{{jsxref("Functions/arguments", "arguments")}}'
     ks = JSxRef(
         raw=raw, args=['Functions/arguments', 'arguments'],
         scope='specification description')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/Functions/arguments"><code>arguments'
          '</code></a>'))
Пример #10
0
 def test_standard(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global
     raw = '{{jsxref("RegExp")}}'
     ks = JSxRef(
         raw=raw, args=['RegExp'], scope='specification description')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/RegExp"><code>RegExp</code></a>'))
     self.assertFalse(ks.issues)
     self.assertEqual(text_type(ks), raw)
Пример #11
0
 def test_dotted_function(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math
     raw = '{{jsxref("Math.log10()", "log10()")}}'
     ks = JSxRef(
         raw=raw, args=["Math.log10()", "log10()"],
         scope='specification description')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/Math/log10"><code>log10()'
          '</code></a>'))
Пример #12
0
 def test_prototype(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
     raw = '{{jsxref("Array.prototype.lastIndexOf", "lastIndexOf")}}'
     ks = JSxRef(
         raw=raw, args=["Array.prototype.lastIndexOf", "lastIndexOf"],
         scope='specification description')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/Array/lastIndexOf"><code>lastIndexOf'
          '</code></a>'))
Пример #13
0
 def test_display_name(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/arguments
     raw = '{{jsxref("Functions/arguments", "arguments")}}'
     ks = JSxRef(
         raw=raw, args=["Functions/arguments", "arguments"],
         scope='specification description')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/Functions/arguments"><code>arguments'
          '</code></a>'))
Пример #14
0
 def test_standard(self):
     # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global
     raw = '{{jsxref("RegExp")}}'
     ks = JSxRef(
         raw=raw, args=['RegExp'], scope='specification description')
     self.assertEqual(
         ks.to_html(),
         ('<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript'
          '/Reference/Global_Objects/RegExp"><code>RegExp</code></a>'))
     self.assertFalse(ks.issues)
     self.assertEqual(text_type(ks), raw)