forked from wooorm/html-element-attributes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
43 lines (37 loc) · 1.13 KB
/
test.js
File metadata and controls
43 lines (37 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'use strict';
/* Dependencies. */
var assert = require('assert');
var test = require('tape');
var htmlElementAttributes = require('./');
/* Tests. */
test('htmlElementAttributes', function (t) {
t.equal(
typeof htmlElementAttributes,
'object',
'should be an `object`'
);
t.doesNotThrow(
function () {
Object.keys(htmlElementAttributes).forEach(function (name) {
assert.ok(Array.isArray(htmlElementAttributes[name]), name);
});
},
'values should be array'
);
t.doesNotThrow(
function () {
Object.keys(htmlElementAttributes).forEach(function (name) {
var props = htmlElementAttributes[name];
props.forEach(function (prop) {
var label = prop + ' in ' + name;
assert.ok(typeof prop, 'string', label + ' should be string');
assert.equal(prop, prop.toLowerCase(), label + ' should be lower-case');
assert.equal(prop, prop.trim(), label + ' should be trimmed');
assert.ok(/^[a-z-]+$/.test(prop), label + ' should be `a-z-`');
});
});
},
'name should be lower-case, alphabetical strings'
);
t.end();
});