UNPKG

website-auditfy

Version:

> Tool for validate your project on SEO, HTML, CSS, JS, TS, Performance, Security and A11Y

26 lines 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HeaderNotEmptyRule = void 0; const message_model_1 = require("../../../models/message.model"); const message_enum_1 = require("../../../enum/message.enum"); class HeaderNotEmptyRule { constructor(dom, lightHouse) { this.id = 'header-not-empty'; this.tags = ['html', 'seo']; this.ruleFlow = message_enum_1.MessageType.error; this.description = 'H1 should be not empty'; this.dom = dom; this.lightHouse = lightHouse; } check() { const tagElements = this.dom('h1'); const tagCount = tagElements.get().length; const tagIsPresent = tagCount !== 0; const tagIsNotEmpty = tagIsPresent ? tagElements.contents().first().text().length !== 0 : false; return [ message_model_1.Message.create(`${this.description} is not empty`, tagIsNotEmpty ? message_enum_1.MessageType.passed : this.ruleFlow) ]; } } exports.HeaderNotEmptyRule = HeaderNotEmptyRule; //# sourceMappingURL=header-not-empty.rule.js.map