UNPKG

website-auditfy

Version:

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

24 lines 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TitleLengthRule = void 0; const message_model_1 = require("../../../models/message.model"); const message_enum_1 = require("../../../enum/message.enum"); class TitleLengthRule { constructor(dom, lightHouse, htmlValidator) { this.id = 'document-title-length'; this.tags = ['html', 'seo']; this.description = 'Title tag has correct length'; this.ruleUrl = 'https://www.w3.org/Provider/Style/TITLE.html'; this.titleLength = 64; this.dom = dom; this.lightHouse = lightHouse; } check() { const titleLengthRule = this.dom('title').text().length <= this.titleLength ? 1 : 0; return [ message_model_1.Message.create(`${this.description} length less ${this.titleLength} characters long`, titleLengthRule ? message_enum_1.MessageType.passed : this.ruleFlow) ]; } } exports.TitleLengthRule = TitleLengthRule; //# sourceMappingURL=title-length.rule.js.map