Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -0,0 +1,41 @@
<?php
namespace Behat\Mink\Tests\Selector;
use Behat\Mink\Selector\CssSelector;
class CssSelectorTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
if (!class_exists('Symfony\Component\CssSelector\CssSelector')) {
$this->markTestSkipped('Symfony2 CssSelector component not installed');
}
}
public function testSelector()
{
$selector = new CssSelector();
$this->assertEquals('descendant-or-self::h3', $selector->translateToXPath('h3'));
$this->assertEquals('descendant-or-self::h3/span', $selector->translateToXPath('h3 > span'));
if (interface_exists('Symfony\Component\CssSelector\XPath\TranslatorInterface')) {
// The rewritten component of Symfony 2.3 checks for attribute existence first for the class.
$expectation = "descendant-or-self::h3/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' my_div ')]";
} else {
$expectation = "descendant-or-self::h3/*[contains(concat(' ', normalize-space(@class), ' '), ' my_div ')]";
}
$this->assertEquals($expectation, $selector->translateToXPath('h3 > .my_div'));
}
/**
* @expectedException \InvalidArgumentException
*/
public function testThrowsForArrayLocator()
{
$selector = new CssSelector();
$selector->translateToXPath(array('h3'));
}
}

View file

@ -0,0 +1,18 @@
<?php
namespace Behat\Mink\Tests\Selector;
use Behat\Mink\Selector\ExactNamedSelector;
class ExactNamedSelectorTest extends NamedSelectorTest
{
protected function getSelector()
{
return new ExactNamedSelector();
}
protected function allowPartialMatch()
{
return false;
}
}

View file

@ -0,0 +1,168 @@
<?php
namespace Behat\Mink\Tests\Selector;
use Behat\Mink\Selector\NamedSelector;
use Behat\Mink\Selector\Xpath\Escaper;
abstract class NamedSelectorTest extends \PHPUnit_Framework_TestCase
{
public function testRegisterXpath()
{
$selector = $this->getSelector();
$selector->registerNamedXpath('some', 'my_xpath');
$this->assertEquals('my_xpath', $selector->translateToXPath('some'));
$this->setExpectedException('InvalidArgumentException');
$selector->translateToXPath('custom');
}
/**
* @expectedException \InvalidArgumentException
*/
public function testInvalidLocator()
{
$namedSelector = $this->getSelector();
$namedSelector->translateToXPath(array('foo', 'bar', 'baz'));
}
/**
* @dataProvider getSelectorTests
*/
public function testSelectors($fixtureFile, $selector, $locator, $expectedExactCount, $expectedPartialCount = null)
{
$expectedCount = $this->allowPartialMatch() && null !== $expectedPartialCount
? $expectedPartialCount
: $expectedExactCount;
// Don't use "loadHTMLFile" due HHVM 3.3.0 issue.
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->loadHTML(file_get_contents(__DIR__.'/fixtures/'.$fixtureFile));
$namedSelector = $this->getSelector();
$xpath = $namedSelector->translateToXPath(array($selector, $locator));
$domXpath = new \DOMXPath($dom);
$nodeList = $domXpath->query($xpath);
$this->assertEquals($expectedCount, $nodeList->length);
}
/**
* @dataProvider getSelectorTests
* @group legacy
*/
public function testEscapedSelectors($fixtureFile, $selector, $locator, $expectedExactCount, $expectedPartialCount = null)
{
// Escape the locator as Mink 1.x expects the caller of the NamedSelector to handle it
$escaper = new Escaper();
$locator = $escaper->escapeLiteral($locator);
$this->testSelectors($fixtureFile, $selector, $locator, $expectedExactCount, $expectedPartialCount);
}
public function getSelectorTests()
{
$fieldCount = 8; // fields without `type` attribute
$fieldCount += 4; // fields with `type=checkbox` attribute
$fieldCount += 4; // fields with `type=radio` attribute
$fieldCount += 4; // fields with `type=file` attribute
// Fixture file, selector name, locator, expected number of exact matched elements, expected number of partial matched elements if different
return array(
'fieldset' => array('test.html', 'fieldset', 'fieldset-text', 2, 3),
'field (name/placeholder/label)' => array('test.html', 'field', 'the-field', $fieldCount),
'field (input, with-id)' => array('test.html', 'field', 'the-field-input', 1),
'field (textarea, with-id)' => array('test.html', 'field', 'the-field-textarea', 1),
'field (select, with-id)' => array('test.html', 'field', 'the-field-select', 1),
'field (input type=submit, with-id) ignored' => array('test.html', 'field', 'the-field-submit-button', 0),
'field (input type=image, with-id) ignored' => array('test.html', 'field', 'the-field-image-button', 0),
'field (input type=button, with-id) ignored' => array('test.html', 'field', 'the-field-button-button', 0),
'field (input type=reset, with-id) ignored' => array('test.html', 'field', 'the-field-reset-button', 0),
'field (input type=hidden, with-id) ignored' => array('test.html', 'field', 'the-field-hidden', 0),
'link (with-href)' => array('test.html', 'link', 'link-text', 5, 9),
'link (without-href) ignored' => array('test.html', 'link', 'bad-link-text', 0),
'link* (role=link)' => array('test.html', 'link', 'link-role-text', 4, 7),
'button (input, name/value/title)' => array('test.html', 'button', 'button-text', 25, 42),
'button (type=image, with-alt)' => array('test.html', 'button', 'button-alt-text', 1, 2),
'button (input type=submit, with-id)' => array('test.html', 'button', 'input-submit-button', 1),
'button (input type=image, with-id)' => array('test.html', 'button', 'input-image-button', 1),
'button (input type=button, with-id)' => array('test.html', 'button', 'input-button-button', 1),
'button (input type=reset, with-id)' => array('test.html', 'button', 'input-reset-button', 1),
'button (button type=submit, with-id)' => array('test.html', 'button', 'button-submit-button', 1),
'button (button type=image, with-id)' => array('test.html', 'button', 'button-image-button', 1),
'button (button type=button, with-id)' => array('test.html', 'button', 'button-button-button', 1),
'button (button type=reset, with-id)' => array('test.html', 'button', 'button-reset-button', 1),
'button* (role=button, name/value/title)' => array('test.html', 'button', 'button-role-text', 12, 20),
'button* (role=button type=submit, with-id)' => array('test.html', 'button', 'role-button-submit-button', 1),
'button* (role=button type=image, with-id)' => array('test.html', 'button', 'role-button-image-button', 1),
'button* (role=button type=button, with-id)' => array('test.html', 'button', 'role-button-button-button', 1),
'button* (role=button type=reset, with-id)' => array('test.html', 'button', 'role-button-reset-button', 1),
'link_or_button (with-href)' => array('test.html', 'link_or_button', 'link-text', 5, 9),
'link_or_button (without-href) ignored' => array('test.html', 'link_or_button', 'bad-link-text', 0),
'link_or_button* (role=link)' => array('test.html', 'link_or_button', 'link-role-text', 4, 7),
// bug in selector: 17 instead of 25 and 34 instead of 42, because 8 buttons with `name` attribute were not matched
'link_or_button (input, name/value/title)' => array('test.html', 'link_or_button', 'button-text', 17, 34),
'link_or_button (type=image, with-alt)' => array('test.html', 'link_or_button', 'button-alt-text', 1, 2),
'link_or_button (input type=submit, with-id)' => array('test.html', 'link_or_button', 'input-submit-button', 1),
'link_or_button (input type=image, with-id)' => array('test.html', 'link_or_button', 'input-image-button', 1),
'link_or_button (input type=button, with-id)' => array('test.html', 'link_or_button', 'input-button-button', 1),
'link_or_button (input type=reset, with-id)' => array('test.html', 'link_or_button', 'input-reset-button', 1),
'link_or_button (button type=submit, with-id)' => array('test.html', 'link_or_button', 'button-submit-button', 1),
'link_or_button (button type=image, with-id)' => array('test.html', 'link_or_button', 'button-image-button', 1),
'link_or_button (button type=button, with-id)' => array('test.html', 'link_or_button', 'button-button-button', 1),
'link_or_button (button type=reset, with-id)' => array('test.html', 'link_or_button', 'button-reset-button', 1),
// bug in selector: 8 instead of 12 and 16 instead of 20, because 4 buttons with `name` attribute were not matched
'link_or_button* (role=button, name/value/title)' => array('test.html', 'link_or_button', 'button-role-text', 8, 16),
'link_or_button* (role=button type=submit, with-id)' => array('test.html', 'link_or_button', 'role-button-submit-button', 1),
'link_or_button* (role=button type=image, with-id)' => array('test.html', 'link_or_button', 'role-button-image-button', 1),
'link_or_button* (role=button type=button, with-id)' => array('test.html', 'link_or_button', 'role-button-button-button', 1),
'link_or_button* (role=button type=reset, with-id)' => array('test.html', 'link_or_button', 'role-button-reset-button', 1),
// 3 matches, because matches every HTML node in path: html > body > div
'content' => array('test.html', 'content', 'content-text', 1, 4),
'content with quotes' => array('test.html', 'content', 'some "quoted" content', 1, 3),
'select (name/label)' => array('test.html', 'select', 'the-field', 3),
'select (with-id)' => array('test.html', 'select', 'the-field-select', 1),
'checkbox (name/label)' => array('test.html', 'checkbox', 'the-field', 3),
'checkbox (with-id)' => array('test.html', 'checkbox', 'the-field-checkbox', 1),
'radio (name/label)' => array('test.html', 'radio', 'the-field', 3),
'radio (with-id)' => array('test.html', 'radio', 'the-field-radio', 1),
'file (name/label)' => array('test.html', 'file', 'the-field', 3),
'file (with-id)' => array('test.html', 'file', 'the-field-file', 1),
'optgroup' => array('test.html', 'optgroup', 'group-label', 1, 2),
'option' => array('test.html', 'option', 'option-value', 2, 3),
'table' => array('test.html', 'table', 'the-table', 2, 3),
'id' => array('test.html', 'id', 'bad-link-text', 1),
'id or name' => array('test.html', 'id_or_name', 'the-table', 2),
);
}
/**
* @return NamedSelector
*/
abstract protected function getSelector();
/**
* @return bool
*/
abstract protected function allowPartialMatch();
}

View file

@ -0,0 +1,18 @@
<?php
namespace Behat\Mink\Tests\Selector;
use Behat\Mink\Selector\PartialNamedSelector;
class PartialNamedSelectorTest extends NamedSelectorTest
{
protected function getSelector()
{
return new PartialNamedSelector();
}
protected function allowPartialMatch()
{
return true;
}
}

View file

@ -0,0 +1,96 @@
<?php
namespace Behat\Mink\Tests\Selector;
use Behat\Mink\Selector\SelectorsHandler;
class SelectorsHandlerTest extends \PHPUnit_Framework_TestCase
{
public function testRegisterSelector()
{
$selector = $this->getMockBuilder('Behat\Mink\Selector\SelectorInterface')->getMock();
$handler = new SelectorsHandler();
$this->assertFalse($handler->isSelectorRegistered('custom'));
$handler->registerSelector('custom', $selector);
$this->assertTrue($handler->isSelectorRegistered('custom'));
$this->assertSame($selector, $handler->getSelector('custom'));
}
public function testRegisterSelectorThroughConstructor()
{
$selector = $this->getMockBuilder('Behat\Mink\Selector\SelectorInterface')->getMock();
$handler = new SelectorsHandler(array('custom' => $selector));
$this->assertTrue($handler->isSelectorRegistered('custom'));
$this->assertSame($selector, $handler->getSelector('custom'));
}
public function testRegisterDefaultSelectors()
{
$handler = new SelectorsHandler();
$this->assertTrue($handler->isSelectorRegistered('css'));
$this->assertTrue($handler->isSelectorRegistered('named_exact'));
$this->assertTrue($handler->isSelectorRegistered('named_partial'));
}
/**
* @expectedException \InvalidArgumentException
*/
public function testXpathSelectorThrowsExceptionForArrayLocator()
{
$handler = new SelectorsHandler();
$handler->selectorToXpath('xpath', array('some_xpath'));
}
public function testXpathSelectorIsReturnedAsIs()
{
$handler = new SelectorsHandler();
$this->assertEquals('some_xpath', $handler->selectorToXpath('xpath', 'some_xpath'));
}
public function testSelectorToXpath()
{
$selector = $this->getMockBuilder('Behat\Mink\Selector\SelectorInterface')->getMock();
$handler = new SelectorsHandler();
$handler->registerSelector('custom_selector', $selector);
$selector
->expects($this->once())
->method('translateToXPath')
->with($locator = 'some[locator]')
->will($this->returnValue($ret = '[]some[]locator'));
$this->assertEquals($ret, $handler->selectorToXpath('custom_selector', $locator));
$this->setExpectedException('InvalidArgumentException');
$handler->selectorToXpath('undefined', 'asd');
}
/**
* @group legacy
*/
public function testXpathLiteral()
{
$handler = new SelectorsHandler();
$this->assertEquals("'some simple string'", $handler->xpathLiteral('some simple string'));
}
/**
* @group legacy
*/
public function testBcLayer()
{
$selector = $this->getMockBuilder('Behat\Mink\Selector\SelectorInterface')->getMock();
$handler = new SelectorsHandler();
$handler->registerSelector('named_partial', $selector);
$this->assertSame($selector, $handler->getSelector('named'));
}
}

View file

@ -0,0 +1,31 @@
<?php
namespace Behat\Mink\Tests\Selector\Xpath;
use Behat\Mink\Selector\Xpath\Escaper;
class EscaperTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider getXpathLiterals
*/
public function testXpathLiteral($string, $expected)
{
$escaper = new Escaper();
$this->assertEquals($expected, $escaper->escapeLiteral($string));
}
public function getXpathLiterals()
{
return array(
array('some simple string', "'some simple string'"),
array('some "d-brackets" string', "'some \"d-brackets\" string'"),
array('some \'s-brackets\' string', "\"some 's-brackets' string\""),
array(
'some \'s-brackets\' and "d-brackets" string',
'concat(\'some \',"\'",\'s-brackets\',"\'",\' and "d-brackets" string\')',
),
);
}
}

View file

@ -0,0 +1,64 @@
<?php
namespace Behat\Mink\Tests\Selector\Xpath;
use Behat\Mink\Selector\Xpath\Manipulator;
class ManipulatorTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider getPrependedXpath
*/
public function testPrepend($prefix, $xpath, $expectedXpath)
{
$manipulator = new Manipulator();
$this->assertEquals($expectedXpath, $manipulator->prepend($xpath, $prefix));
}
public function getPrependedXpath()
{
return array(
'simple' => array(
'some_xpath',
'some_tag1',
'some_xpath/some_tag1',
),
'with slash' => array(
'some_xpath',
'/some_tag1',
'some_xpath/some_tag1',
),
'union' => array(
'some_xpath',
'some_tag1 | some_tag2',
'some_xpath/some_tag1 | some_xpath/some_tag2',
),
'wrapped union' => array(
'some_xpath',
'(some_tag1 | some_tag2)/some_child',
'(some_xpath/some_tag1 | some_xpath/some_tag2)/some_child',
),
'multiple wrapped union' => array(
'some_xpath',
'( ( some_tag1 | some_tag2)/some_child | some_tag3)/leaf',
'( ( some_xpath/some_tag1 | some_xpath/some_tag2)/some_child | some_xpath/some_tag3)/leaf',
),
'parent union' => array(
'some_xpath | another_xpath',
'some_tag1 | some_tag2',
'(some_xpath | another_xpath)/some_tag1 | (some_xpath | another_xpath)/some_tag2',
),
'complex condition' => array(
'some_xpath',
'some_tag1 | some_tag2[@foo = "bar|"] | some_tag3[foo | bar]',
'some_xpath/some_tag1 | some_xpath/some_tag2[@foo = "bar|"] | some_xpath/some_tag3[foo | bar]',
),
'multiline' => array(
'some_xpath',
"some_tag1 | some_tag2[@foo =\n 'bar|'']\n | some_tag3[foo | bar]",
"some_xpath/some_tag1 | some_xpath/some_tag2[@foo =\n 'bar|''] | some_xpath/some_tag3[foo | bar]",
),
);
}
}

View file

@ -0,0 +1,312 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="test-for-link-selector">
<!-- match links with `href` attribute -->
<a href="#" id="link-text"></a>
<a href="#">link-text</a>
<a href="#" title="link-text"></a>
<a href="#" rel="link-text"></a>
<a href="#">
<img src="#" alt="link-text"/>
</a>
<!-- partial match -->
<a href="#">some link-text</a>
<a href="#" title="some link-text"></a>
<a href="#" rel="some link-text"></a>
<a href="#">
<img src="#" alt="some link-text"/>
</a>
<!-- don't match links without `href` attribute -->
<a id="bad-link-text"></a>
<a>bad-link-text</a>
<a title="bad-link-text"></a>
<a rel="bad-link-text"></a>
<a>
<img src="#" alt="bad-link-text"/>
</a>
<!-- match links with `role=link` attribute -->
<span role="Link" id="link-role-text"></span>
<span role="lInk" value="link-role-text"></span>
<span role="liNk" title="link-role-text"></span>
<span role="linK">link-role-text</span>
<!-- partial match -->
<span role="link" value="some link-role-text"></span>
<span role="link" title="some link-role-text"></span>
<span role="link">some link-role-text</span>
</div>
<div id="test-for-fieldset-selector">
<!-- match fieldsets -->
<fieldset id="fieldset-text"></fieldset>
<fieldset>
<legend>fieldset-text</legend>
</fieldset>
<!-- partial match -->
<fieldset>
<legend>fieldset-text sample</legend>
</fieldset>
<!-- don't match fieldsets -->
<fieldset>fieldset-text</fieldset>
<fieldset></fieldset>
</div>
<div id="test-for-content-selector">
content-text
</div>
<!-- partial match -->
<div id="test-for-partial-content-selector">
some content-text
</div>
<div>some "quoted" content</div>
<form>
<div id="test-for-field-selector">
<!-- match fields by `id` attribute -->
<input id="the-field-input"/>
<textarea id="the-field-textarea"></textarea>
<select id="the-field-select"></select>
<!-- match fields by `name` attribute -->
<input name="the-field"/>
<textarea name="the-field"></textarea>
<select name="the-field"></select>
<!-- match fields by `placeholder` attribute -->
<input placeholder="the-field"/>
<textarea placeholder="the-field"></textarea>
<select placeholder="the-field"></select>
<!-- match fields by associated label -->
<label for="label-for-input">the-field</label><input id="label-for-input"/>
<label for="label-for-textarea">the-field</label><textarea id="label-for-textarea"></textarea>
<label for="label-for-select">the-field</label><select id="label-for-select"></select>
<!-- match fields, surrounded by matching label -->
<label>the-field<input/></label>
<label>the-field<textarea></textarea></label>
<label>the-field<select></select></label>
<!-- don't match fields by `id` attribute -->
<input type="Submit" id="the-field-submit-button"/>
<input type="iMage" id="the-field-image-button"/>
<input type="butTon" id="the-field-button-button"/>
<input type="resEt" id="the-field-reset-button"/>
<input type="hidDen" id="the-field-hidden"/>
<!-- don't match fields by `name` attribute -->
<input type="submit" name="the-field"/>
<input type="image" name="the-field"/>
<input type="button" name="the-field"/>
<input type="reset" name="the-field"/>
<input type="hidden" name="the-field"/>
<!-- don't match fields by `placeholder` attribute -->
<input type="submit" placeholder="the-field"/>
<input type="image" placeholder="the-field"/>
<input type="button" placeholder="the-field"/>
<input type="reset" placeholder="the-field"/>
<input type="hidden" placeholder="the-field"/>
<!-- don't match fields by associated label -->
<label for="label-for-the-field-submit-button">the-field</label><input type="submit" id="label-for-the-field-submit-button"/>
<label for="label-for-the-field-image-button">the-field</label><input type="image" id="label-for-the-field-image-button"/>
<label for="label-for-the-field-button-button">the-field</label><input type="button" id="label-for-the-field-button-button"/>
<label for="label-for-the-field-reset-button">the-field</label><input type="reset" id="label-for-the-field-reset-button"/>
<label for="label-for-the-field-hidden">the-field</label><input type="hidden" id="label-for-the-field-hidden"/>
<!-- don't match fields, surrounded by matching label -->
<label>the-field<input type="submit"/></label>
<label>the-field<input type="image"/></label>
<label>the-field<input type="button"/></label>
<label>the-field<input type="reset"/></label>
<label>the-field<input type="hidden"/></label>
</div>
<div id="test-for-button-selector">
<!-- match buttons by `id` attribute -->
<input type="Submit" id="input-submit-button"/>
<input type="iMage" id="input-image-button"/>
<input type="butTon" id="input-button-button"/>
<input type="resEt" id="input-reset-button"/>
<button type="submit" id="button-submit-button"></button>
<button type="image" id="button-image-button"></button>
<button type="button" id="button-button-button"></button>
<button type="reset" id="button-reset-button"></button>
<!-- match buttons by `name` attribute -->
<input type="submit" name="button-text"/>
<input type="image" name="button-text"/>
<input type="button" name="button-text"/>
<input type="reset" name="button-text"/>
<button type="submit" name="button-text"></button>
<button type="image" name="button-text"></button>
<button type="button" name="button-text"></button>
<button type="reset" name="button-text"></button>
<!-- match buttons by `value` attribute -->
<input type="submit" value="button-text"/>
<input type="image" value="button-text"/>
<input type="button" value="button-text"/>
<input type="reset" value="button-text"/>
<button type="submit" value="button-text"></button>
<button type="image" value="button-text"></button>
<button type="button" value="button-text"></button>
<button type="reset" value="button-text"></button>
<!-- Partial match -->
<input type="submit" value="some button-text"/>
<input type="image" value="some button-text"/>
<input type="button" value="some button-text"/>
<input type="reset" value="some button-text"/>
<button type="submit" value="some button-text"></button>
<button type="image" value="some button-text"></button>
<button type="button" value="some button-text"></button>
<button type="reset" value="some button-text"></button>
<!-- match buttons by `title` attribute -->
<input type="submit" title="button-text"/>
<input type="image" title="button-text"/>
<input type="button" title="button-text"/>
<input type="reset" title="button-text"/>
<button type="submit" title="button-text"></button>
<button type="image" title="button-text"></button>
<button type="button" title="button-text"></button>
<button type="reset" title="button-text"></button>
<!-- partial match -->
<input type="submit" title="some button-text"/>
<input type="image" title="some button-text"/>
<input type="button" title="some button-text"/>
<input type="reset" title="some button-text"/>
<button type="submit" title="some button-text"></button>
<button type="image" title="some button-text"></button>
<button type="button" title="some button-text"></button>
<button type="reset" title="some button-text"></button>
<!-- match some buttons by `alt` attribute -->
<input type="submit" alt="button-alt-text"/>
<input type="imaGe" alt="button-alt-text"/>
<input type="button" alt="button-alt-text"/>
<input type="reset" alt="button-alt-text"/>
<!-- partial match -->
<input type="submit" alt="some button-alt-text"/>
<input type="image" alt="some button-alt-text"/>
<input type="button" alt="some button-alt-text"/>
<input type="reset" alt="some button-alt-text"/>
<!-- match by `button` text -->
<button>button-text</button>
<!-- partial match -->
<button>some button-text</button>
<!-- match buttons with `role=button` & `id` attribute -->
<span role="Button" type="submit" id="role-button-submit-button"></span>
<span role="bUtton" type="image" id="role-button-image-button"></span>
<span role="buTton" type="button" id="role-button-button-button"></span>
<span role="butTon" type="reset" id="role-button-reset-button"></span>
<!-- match buttons with `role=button` & `name` attribute -->
<span role="buttOn" type="submit" name="button-role-text"></span>
<span role="buttoN" type="image" name="button-role-text"></span>
<span role="button" type="button" name="button-role-text"></span>
<span role="button" type="reset" name="button-role-text"></span>
<!-- match buttons with `role=button` & `value` attribute -->
<span role="button" type="submit" value="button-role-text"></span>
<span role="button" type="image" value="button-role-text"></span>
<span role="button" type="button" value="button-role-text"></span>
<span role="button" type="reset" value="button-role-text"></span>
<!-- partial match -->
<span role="button" type="submit" value="some button-role-text"></span>
<span role="button" type="image" value="some button-role-text"></span>
<span role="button" type="button" value="some button-role-text"></span>
<span role="button" type="reset" value="some button-role-text"></span>
<!-- match buttons with `role=button` & `title` attribute -->
<span role="button" type="submit" title="button-role-text"></span>
<span role="button" type="image" title="button-role-text"></span>
<span role="button" type="button" title="button-role-text"></span>
<span role="button" type="reset" title="button-role-text"></span>
<!-- partial match -->
<span role="button" type="submit" title="some button-role-text"></span>
<span role="button" type="image" title="some button-role-text"></span>
<span role="button" type="button" title="some button-role-text"></span>
<span role="button" type="reset" title="some button-role-text"></span>
</div>
<div id="test-for-checkbox-selector">
<input type="Checkbox" id="the-field-checkbox"/>
<input type="checkBox" name="the-field"/>
<input type="cheCkbox" placeholder="the-field"/>
<label for="label-for-checkbox">the-field</label><input type="checkboX" id="label-for-checkbox"/>
<label>the-field<input type="chEckbox"/></label>
</div>
<div id="test-for-radio-selector">
<input type="Radio" id="the-field-radio"/>
<input type="raDio" name="the-field"/>
<input type="radIo" placeholder="the-field"/>
<label for="label-for-radio">the-field</label><input type="radiO" id="label-for-radio"/>
<label>the-field<input type="radIo"/></label>
</div>
<div id="test-for-file-selector">
<input type="File" id="the-field-file"/>
<input type="fIle" name="the-field"/>
<input type="fiLe" placeholder="the-field"/>
<label for="label-for-file">the-field</label><input type="filE" id="label-for-file"/>
<label>the-field<input type="fiLe"/></label>
</div>
<div id="test-for-select-related-stuff">
<!-- match select stuff -->
<select name="the-select-stuff-test">
<optgroup label="group-label">
<option value="option-value"></option>
</optgroup>
<option value="">option-value</option>
<!-- partial match -->
<optgroup label="some group-label">
<option value="">some option-value</option>
</optgroup>
</select>
<!-- don't match select stuff -->
<select name="the-select-stuff-test">
<optgroup label="">some group-label</optgroup>
<option value="some option-value"></option>
</select>
</div>
</form>
<div id="test-for-table-selector">
<!-- match tables -->
<table id="the-table"></table>
<table>
<caption>the-table</caption>
</table>
<!-- partial match -->
<table>
<caption>some the-table</caption>
</table>
<!-- don't match tables -->
<table>
<tr>
<th>the-table</th>
<td>the-table</td>
</tr>
</table>
</div>
<input name="the-table"/>
</body>
</html>