You are here

public function ElementsTest::testIsA in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/test/HTML5/ElementsTest.php \Masterminds\HTML5\Tests\ElementsTest::testIsA()

File

vendor/masterminds/html5/test/HTML5/ElementsTest.php, line 358

Class

ElementsTest

Namespace

Masterminds\HTML5\Tests

Code

public function testIsA() {
  $this
    ->assertTrue(Elements::isA('script', Elements::KNOWN_ELEMENT));
  $this
    ->assertFalse(Elements::isA('scriptypoo', Elements::KNOWN_ELEMENT));
  $this
    ->assertTrue(Elements::isA('script', Elements::TEXT_RAW));
  $this
    ->assertFalse(Elements::isA('script', Elements::TEXT_RCDATA));
  $voidElements = array(
    'area',
    'base',
    'basefont',
    'bgsound',
    'br',
    'col',
    'command',
    'embed',
    'frame',
    'hr',
    'img',
  );
  foreach ($voidElements as $element) {
    $this
      ->assertTrue(Elements::isA($element, Elements::VOID_TAG), 'Void element test failed on: ' . $element);
  }
  $nonVoid = array(
    'span',
    'a',
    'div',
  );
  foreach ($nonVoid as $tag) {
    $this
      ->assertFalse(Elements::isA($tag, Elements::VOID_TAG), 'Void element test failed on: ' . $tag);
  }
  $blockTags = array(
    'address',
    'article',
    'aside',
    'audio',
    'blockquote',
    'canvas',
    'dd',
    'div',
    'dl',
    'fieldset',
    'figcaption',
    'figure',
    'footer',
    'form',
    'h1',
    'h2',
    'h3',
    'h4',
    'h5',
    'h6',
    'header',
    'hgroup',
    'hr',
    'noscript',
    'ol',
    'output',
    'p',
    'pre',
    'section',
    'table',
    'tfoot',
    'ul',
    'video',
  );
  foreach ($blockTags as $tag) {
    $this
      ->assertTrue(Elements::isA($tag, Elements::BLOCK_TAG), 'Block tag test failed on: ' . $tag);
  }
  $nonBlockTags = array(
    'span',
    'img',
    'label',
  );
  foreach ($nonBlockTags as $tag) {
    $this
      ->assertFalse(Elements::isA($tag, Elements::BLOCK_TAG), 'Block tag test failed on: ' . $tag);
  }
}