|
|
@@ -1,4 +1,4 @@
|
|
|
-import { notDeepEqual } from 'assert';
|
|
|
+import assert from 'assert';
|
|
|
|
|
|
import { attributes, tagNames } from './recommended-whitelist';
|
|
|
|
|
|
@@ -80,4 +80,103 @@ describe('recommended-whitelist', () => {
|
|
|
'data-footnote-backref',
|
|
|
]);
|
|
|
});
|
|
|
+
|
|
|
+ // Tests for restored semantic HTML tags
|
|
|
+ describe('semantic HTML tags restored from v6.3.5', () => {
|
|
|
+ test('.tagNames should include abbr tag', () => {
|
|
|
+ expect(tagNames).toContain('abbr');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.tagNames should include bdo tag', () => {
|
|
|
+ expect(tagNames).toContain('bdo');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.tagNames should include caption tag', () => {
|
|
|
+ expect(tagNames).toContain('caption');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.tagNames should include cite tag', () => {
|
|
|
+ expect(tagNames).toContain('cite');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.tagNames should include dfn tag', () => {
|
|
|
+ expect(tagNames).toContain('dfn');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.tagNames should include figure tag', () => {
|
|
|
+ expect(tagNames).toContain('figure');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.tagNames should include figcaption tag', () => {
|
|
|
+ expect(tagNames).toContain('figcaption');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.tagNames should include mark tag', () => {
|
|
|
+ expect(tagNames).toContain('mark');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.tagNames should include small tag', () => {
|
|
|
+ expect(tagNames).toContain('small');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.tagNames should include time tag', () => {
|
|
|
+ expect(tagNames).toContain('time');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.tagNames should include wbr tag', () => {
|
|
|
+ expect(tagNames).toContain('wbr');
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('attributes for semantic HTML tags', () => {
|
|
|
+ test('.attributes should have abbr with title attribute', () => {
|
|
|
+ expect(attributes).not.toBeNull();
|
|
|
+ assert(attributes != null);
|
|
|
+ expect(Object.keys(attributes)).toContain('abbr');
|
|
|
+ expect(attributes.abbr).toContain('title');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.attributes should have bdo with dir attribute', () => {
|
|
|
+ expect(attributes).not.toBeNull();
|
|
|
+ assert(attributes != null);
|
|
|
+ expect(Object.keys(attributes)).toContain('bdo');
|
|
|
+ expect(attributes.bdo).toContain('dir');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.attributes should have dfn with title attribute', () => {
|
|
|
+ expect(attributes).not.toBeNull();
|
|
|
+ assert(attributes != null);
|
|
|
+ expect(Object.keys(attributes)).toContain('dfn');
|
|
|
+ expect(attributes.dfn).toContain('title');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.attributes should have time with datetime attribute', () => {
|
|
|
+ expect(attributes).not.toBeNull();
|
|
|
+ assert(attributes != null);
|
|
|
+ expect(Object.keys(attributes)).toContain('time');
|
|
|
+ expect(attributes.time).toContain('datetime');
|
|
|
+ });
|
|
|
+
|
|
|
+ test('.attributes should have empty arrays for tags without specific attributes', () => {
|
|
|
+ expect(attributes).not.toBeNull();
|
|
|
+
|
|
|
+ // Tags that should have empty attribute arrays
|
|
|
+ const tagsWithEmptyAttributes = [
|
|
|
+ 'caption',
|
|
|
+ 'cite',
|
|
|
+ 'figure',
|
|
|
+ 'figcaption',
|
|
|
+ 'mark',
|
|
|
+ 'small',
|
|
|
+ 'wbr',
|
|
|
+ ];
|
|
|
+
|
|
|
+ tagsWithEmptyAttributes.forEach((tag) => {
|
|
|
+ assert(attributes != null);
|
|
|
+
|
|
|
+ expect(Object.keys(attributes)).toContain(tag);
|
|
|
+ expect(attributes[tag]).toEqual([]);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|