<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../resources/common.js"></script>
<script src="../resources/label-test-util.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description('Test labelable elements have labels attribute and others do not.');

var tester = setupLabelsTest(withParentLabel);
for (var name in tester.dataSet) {
    var data = tester.dataSet[name];
    var element = data.element;
    if (!data.isSupported && !data.inputType) {
        debug('\nUnsupported: ' + name + ' ' + element);
        shouldBeUndefined('element.labels');
        shouldNotBe('element.labels', 'null');
    } else if (!data.isLabelable) {
        debug('\nNot labelable: ' + name + ' ' + element);
        if (data.inputType) {
            // Note: labels attribute of input element isn't undefined,
            // because HTMLInputElement.idl defines labels attribute.
            shouldBe('element.labels', 'null');
        } else {
            shouldBeUndefined('element.labels');
            shouldNotBe('element.labels', 'null');
        }
    } else {
        debug('\nLabelable: ' + name + ' ' + element);
        shouldBe('element.labels.length', '1');
    }
}
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
