Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps-dev): Bump html-validate from 8.8.0 to 8.9.0 #1073

Merged
merged 28 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a9a515c
build(deps-dev): Bump html-validate from 8.8.0 to 8.9.0
dependabot[bot] Jan 8, 2024
5e670c3
still wip, fix html validator error in gcweb footer-en
j-paquette Jan 10, 2024
4c31f29
still wip, remaining html validate error in WET code
j-paquette Jan 10, 2024
2f4586a
still wip, fixed 2 html-validate errors, fix to generate static pages…
j-paquette Jan 11, 2024
318981a
still wip, fix html validator errors in gcintranet-secmenu-en.html
j-paquette Jan 17, 2024
60cf7cb
fixes html-validate errors in build
j-paquette Jan 17, 2024
239745e
still wip, fix npm test html-validate errors
j-paquette Jan 19, 2024
c497f3a
still wip, continue fixing html-validate errors intranet-top
j-paquette Jan 22, 2024
7aa8cb1
still wip, fix appTop html-validate errors
j-paquette Jan 23, 2024
0888b3a
still wip, fix gcweb-appTop-externalLinkMenu-en errors
j-paquette Jan 24, 2024
d00bf59
still wip, fix the aria-label to contain text
j-paquette Jan 25, 2024
2954dbf
still wip, finish correcting appTop gcintranet
j-paquette Jan 29, 2024
24d3561
still wip, continue fixing errors
j-paquette Jan 30, 2024
0b0972b
still wip, fix errors in gcintranet-appTop-externalLinkMenu-en
j-paquette Jan 31, 2024
09ec7ce
tests passed html-validate
j-paquette Feb 1, 2024
9a07261
tests passed with change
j-paquette Feb 1, 2024
6b0f48b
still wip, renamed to match top.ejs
j-paquette Feb 5, 2024
9b3e729
still wip, new corrections for aria-labels
j-paquette Feb 7, 2024
2fc3bb0
still wip, new corrections
j-paquette Feb 8, 2024
36bcc38
still wip, fix remaining errors
j-paquette Mar 7, 2024
ed9c5f1
resolved code comments
j-paquette Mar 8, 2024
1cc0180
forgot to chg code for a comment
j-paquette Mar 8, 2024
0ee60e6
fixed minor syntax
j-paquette Mar 8, 2024
51902f7
corrected for duplicate account menu name
j-paquette Mar 8, 2024
bbc5096
still wip, remove unit tests that were created in this PR
j-paquette Mar 13, 2024
7c1ab16
fixed to include new rules in v8.15.0
j-paquette Mar 14, 2024
92a9707
fixes code as per additional comments
j-paquette Mar 19, 2024
86370cd
fixes code based on latest comments
j-paquette Mar 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions StaticFileCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,22 @@ function createStaticFallbackFile(grunt, definition, language) {
output = defaultContentFilter(grunt, output, definition, language, targetFileName);
if (definition.filterContent) output = definition.filterContent(grunt, output, definition, language, targetFileName);

//---[ Output to file
//NOTE: Generate the files before validating the HTML, for troubleshooting
if (!fs.existsSync(distStaticTargetDirName)) fs.mkdirSync(distStaticTargetDirName); //create target directory if it doesn't exist
fs.writeFileSync(targetFileName, output, { encoding: 'utf8' });

//---[ Validate HTML before we save
const htmlValidate = new HtmlValidate(require('./htmlvalidator.conf.js'));
const htmlValidateFormatReport = formatterFactory('stylish'); //possible formatters: checkstyle, codeframe, json, stylish, text
const htmlValidateFormatReport = formatterFactory('codeframe'); //possible formatters: checkstyle, codeframe, json, stylish, text
const report = htmlValidate.validateStringSync(output);
if ((!report.valid) || (report.warningCount > 0)) {
grunt.log.error(`${targetFileName}: ${report.errorCount} error(s), ${report.warningCount} warning(s) reported:`);
grunt.log.error(htmlValidateFormatReport(report.results));
if (report.errorCount > 0) throw new Error('HTML validator error reported, aborting.');
}

//---[ Output to file
if (!fs.existsSync(distStaticTargetDirName)) fs.mkdirSync(distStaticTargetDirName); //create target directory if it doesn't exist
fs.writeFileSync(targetFileName, output, { encoding: 'utf8' });

}

module.exports = function generateStaticFile(grunt, themeName, definitionFileBasename, getStaticFileDefinition) {
Expand Down
8 changes: 4 additions & 4 deletions TestFileGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function searchFunctionCalls(content) {

function validateBuilderFunctions(content, theme, version) {
const htmlValidate = new HtmlValidate(require('./htmlvalidator.conf.js')); //config path relative
const htmlValidateFormatReport = formatterFactory('stylish'); //possible formatters: checkstyle, codeframe, json, stylish, text
const htmlValidateFormatReport = formatterFactory('codeframe'); //possible formatters: checkstyle, codeframe, json, stylish, text

function validateHTML(functionName, htmlContent) {
const report = htmlValidate.validateStringSync(htmlContent);
Expand Down Expand Up @@ -159,7 +159,7 @@ module.exports = function generateTestFile(inputFilePath, theme, outputFileName,
}
return;
}

console.log(`TestFileGenerator processing ${inputFilePath} -> ${theme}/${outputFileName}`);
let data = fs.readFileSync(inputFilePath, 'utf8');

if (data.match(/wet\.builder\.[\S]*[sS]etup\(/gm) !== null || data.match(setupAttributeRegex) !== null) {
Expand Down Expand Up @@ -197,8 +197,8 @@ module.exports = function generateTestFile(inputFilePath, theme, outputFileName,
data = data.replace('"~' + Object.keys(sections)[i] + '~"', sections[Object.keys(sections)[i]]);
}

fs.writeFileSync(filePath, data, 'utf8');

//---[ Before writing data to disk, validate the output of the various 'wet.builder.*' functions.
validateBuilderFunctions(data, theme, version);

fs.writeFileSync(filePath, data, 'utf8');
}
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"grunt-contrib-uglify": "^5.2.2",
"grunt-contrib-watch": "^1.1.0",
"grunt-eslint": "^24.3.0",
"html-validate": "^8.8.0",
"html-validate": "^8.9.0",
"https-proxy-agent": "^7.0.4",
"isbinaryfile": "^5.0.2"
}
Expand Down
26 changes: 15 additions & 11 deletions src/gcintranet/appFooter.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@
* @param? cdnEnv Used to switch between qat, nonprod, and prod CDN implementations.
-%>
<%_ if (pr.showFeatures == true) { -%>
<section class="ajaxed-in" data-ajax-replace="<%- wet.builder.environment(pr.cdnEnv) %>cdts/ajax/<^- msg('activities-footer-eng.html') ^>"></section>
<section class="ajaxed-in" data-ajax-replace="<%- wet.builder.environment(pr.cdnEnv) %>cdts/ajax/<^- msg('activities-footer-eng.html') ^>" aria-label="<^- msg('Activities and initiatives') ^>"></section>
<%_ } -%>
<footer role="contentinfo" id="wb-info">
<%_ if (pr.footerSections != null) { -%>
<nav role="navigation" class="container wb-navcurr">
<h2 class="wb-inv"><^- msg('Related links') ^></h2>
<nav role="navigation" class="container wb-navcurr" aria-labelledby="cdts-relatedLinks">
<h2 class="wb-inv" id="cdts-relatedLinks"><^- msg('Related links') ^></h2>
<div class="row">
<%_ for (var sectionIndex=0; sectionIndex<pr.footerSections.length; sectionIndex++) {
const footerSection=pr.footerSections[sectionIndex];-%>
<%_ if (footerSection.customFooterLinks != null) { -%>
<%_ if (sectionIndex < 3) { -%>
<section class="col-md-3 col-sm-6 col-lg-3">
<%_ if (footerSection.sectionName != null) { -%>
<h3><%= footerSection.sectionName %></h3>
<section class="col-md-3 col-sm-6 col-lg-3" aria-labelledby="cdts-footerSection<%= sectionIndex %>">
<h3 id="cdts-footerSection<%= sectionIndex %>"><%= footerSection.sectionName %></h3>
<%_ } else { -%>
<section class="col-md-3 col-sm-6 col-lg-3" aria-label="<^- msg('Footer') ^>">
<%_ } -%>
<ul class="list-unstyled">
<%_ for (var linkIndex=0; linkIndex<footerSection.customFooterLinks.length; linkIndex++) {
Expand All @@ -32,9 +34,11 @@
</section>
<%_ } -%>
<%_ } else if (sectionIndex == 0) { /*For backward compatibility */ -%>
<section class="col-md-3 col-sm-6 col-lg-3">
<%_ if (footerSection.sectionName != null) { -%>
<h3><%= footerSection.sectionName %></h3>
<section class="col-md-3 col-sm-6 col-lg-3" aria-labelledby="cdts-footerSection">
<h3 id="cdts-footerSection"><%= footerSection.sectionName %></h3>
<%_ } else { -%>
<section class="col-md-3 col-sm-6 col-lg-3" aria-label="<^- msg('Footer') ^>">
<%_ } -%>
<ul class="list-unstyled">
<%_ for (var linkIndex=0; linkIndex<pr.footerSections.length; linkIndex++) {
Expand All @@ -46,8 +50,8 @@
<%_ } -%>
<%_ } -%>
<%_ if (pr.subTheme == 'esdc' || pr.subTheme == 'labour') { -%>
<section class="col-md-3 col-sm-6 col-lg-3">
<h3><^- msg('Corporate') ^></h3>
<section class="col-md-3 col-sm-6 col-lg-3" aria-labelledby="cdts-sectionCorporate">
<h3 id="cdts-sectionCorporate"><^- msg('Corporate') ^></h3>
<ul class="list-unstyled">
<li><a href="<^- msg('https://esdc.prv/en/branches_regions/index.shtml') ^>"><^- msg('ESDC/SC Intranet') ^></a></li>
<li><a href="<^- msg('https://esdc.prv/en/news/index.shtml') ^>"><^- msg('News') ^></a></li>
Expand All @@ -57,8 +61,8 @@
</ul>
</section>
<%_ } else if (pr.subTheme == 'eccc') { -%>
<section class="col-md-3 col-sm-6 col-lg-3">
<h3><^- msg('Contact Us') ^></h3>
<section class="col-md-3 col-sm-6 col-lg-3" aria-labelledby="cdts-contactUs">
<h3 id="cdts-contactUs"><^- msg('Contact Us') ^></h3>
<ul class="list-unstyled">
<li><a href="#"><^- msg('EnviroTel') ^></a></li>
<li><a href="#"><^- msg('GEDS') ^></a></li>
Expand Down
40 changes: 20 additions & 20 deletions src/gcintranet/appTop.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ if (pr.subTheme === 'eccc') {
<%_ } -%>
</ul>
</nav>
<header role="banner">
<header role="banner" aria-label="<^- msg('GCintranet header') ^>">
<div id="wb-bnr">
<div id="app-brand">
<div class="container">
<div class="row">
<section class="<%- (pr.intranetTitle != null || pr.subTheme != null)? 'col-lg-6 col-md-6': 'col-lg-2 col-md-3' %> col-sm-9 col-xs-8">
<section class="<%- (pr.intranetTitle != null || pr.subTheme != null)? 'col-lg-6 col-md-6': 'col-lg-2 col-md-3' %> col-sm-9 col-xs-8" aria-label="<^- msg('GC') ^><^- msg('intranet') ^>">
<div class="app-name<%- (pr.intranetTitle != null)? ' app-name-lg': '' %>">
<%_ if (pr.intranetTitle != null && pr.intranetTitle.length > 0) {
const item=pr.intranetTitle[0]; -%>
Expand All @@ -82,18 +82,18 @@ if (pr.subTheme === 'eccc') {
</div>
</section>
<%_ if (pr.GCToolsModal == true) { -%>
<section id="gctoolsSection" class="<%- (pr.intranetTitle != null)? 'col-lg-2': 'col-lg-6' %><%- (pr.search == false)? ' col-md-offset-3': ''%> col-md-1 hidden-sm hidden-xs text-right">
<h2 class="wb-inv"><^- msg('GCTools links') ^></h2>
<section id="gctoolsSection" class="<%- (pr.intranetTitle != null)? 'col-lg-2': 'col-lg-6' %><%- (pr.search == false)? ' col-md-offset-3': ''%> col-md-1 hidden-sm hidden-xs text-right" aria-labelledby="cdts-hiddenGctoolsLinks">
<h2 class="wb-inv" id="cdts-hiddenGctoolsLinks"><^- msg('GCTools links') ^></h2>
<div class="row">
<div class="col-md-12">
<ul class="list-inline margin-bottom-none gcbarlng">
<li><a class="wb-lbx" href="#gctools"><^- msg('<span class="bold-gc">GC</span>Tools') ^></a></li>
</ul>
</div>
</div>
<section id="gctools" class="mfp-hide modal-dialog modal-content overlay-def">
<header class="modal-header">
<h2 class="modal-title"><^- msg('<span class="bold-gc">GC</span>Tools') ^></h2>
<section id="gctools" class="mfp-hide modal-dialog modal-content overlay-def" aria-label="<^- msg('GCTools section') ^>">
<header class="modal-header" aria-labelledby="cdts-gctoolsPopupHeader">
<h2 class="modal-title" id="cdts-gctoolsPopupHeader"><^- msg('<span class="bold-gc">GC</span>Tools') ^></h2>
</header>
<div class="modal-body">
<ul class="list-unstyled lst-spcd">
Expand All @@ -108,7 +108,7 @@ if (pr.subTheme === 'eccc') {
</section>
</section>
<%_ } else if (pr.intranetTitle == null) { /* (...== null) is intentional, not (...!= null) */-%>
<section id="wb-gctools" class="col-lg-6 visible-lg">
<section id="wb-gctools" class="col-lg-6 visible-lg" aria-label="<^- msg('GC Tools') ^>">
<div class="pull-left tool-link">
<a href="<^- msg('https://gcconnex.gc.ca/splash/') ^>" class="<^- msg('GCTBannerOnclick-eng') ^>">
<^- msg('<span class="bold-gc">GC</span>connex') ^></a>
Expand All @@ -128,8 +128,8 @@ if (pr.subTheme === 'eccc') {
</section>
<%_ } -%>
<%_ if (pr.lngLinks != null) { -%>
<section id="wb-lng" class="<%- (pr.intranetTitle != null && pr.GCToolsModal != true)? 'mrgn-bttm-md col-md-offset-1 col-lg-offset-2 ': '' %>col-md-1 hidden-sm hidden-xs text-right <%- (pr.search == false)? 'lang-no-search': (pr.GCToolsModal == true)? '': 'lang-with-search'%>">
<h2 class="wb-inv"><^- msg('Language selection') ^></h2>
<section id="wb-lng" class="<%- (pr.intranetTitle != null && pr.GCToolsModal != true)? 'mrgn-bttm-md col-md-offset-1 col-lg-offset-2 ': '' %>col-md-1 hidden-sm hidden-xs text-right <%- (pr.search == false)? 'lang-no-search': (pr.GCToolsModal == true)? '': 'lang-with-search'%>" aria-labelledby="cdts-languageSelection">
<h2 class="wb-inv" id="cdts-languageSelection"><^- msg('Language selection') ^></h2>
<div class="row">
<div class="col-md-12">
<ul class="list-inline margin-bottom-none gcbarlng">
Expand All @@ -143,8 +143,8 @@ if (pr.subTheme === 'eccc') {
</section>
<%_ } -%>
<%_ if (pr.search != false) { -%>
<section id="wb-srch" class="col-lg-3 col-md-4 hidden-sm hidden-xs search-md">
<h2><^- msg('Search') ^></h2>
<section id="wb-srch" class="col-lg-3 col-md-4 hidden-sm hidden-xs search-md" aria-labelledby="cdts-hiddenSearch">
<h2 id="cdts-hiddenSearch"><^- msg('Search') ^></h2>
<%_ if (pr.customSearch != null && pr.customSearch.length > 0) {
const item=pr.customSearch[0]; -%>
<form action="<%- (item.action != null)? item.action: '<^- msg('https://intranet.canada.ca/search-recherche/query-recherche-eng.aspx') ^>' %>" method="<%= (item.method != null)? item.method: 'get' %>" name="<%= (item.name != null)? item.name: 'cse-search-box'%>" role="search" class="form-inline">
Expand Down Expand Up @@ -182,9 +182,9 @@ if (pr.subTheme === 'eccc') {
<%_ } -%>
</section>
<%_ } -%>
<section id="wb-glb-mn" class="wb-mb-links col-xs-4 col-sm-3 visible-sm visible-xs">
<section id="wb-glb-mn" class="wb-mb-links col-xs-4 col-sm-3 visible-sm visible-xs" aria-labelledby="cdts-searchAndMenu">
<%_ var pluralSuffix = (pr.topSecMenu != null)? 's': ''; -%>
<h2><%_ if (pr.search == false) { -%><^- msg('Menu') ^><%- pluralSuffix %><%_ } else { -%><^- msg('Search and menu') ^><%- pluralSuffix %><%_ } -%></h2>
<h2 id="cdts-searchAndMenu"><%_ if (pr.search == false) { -%><^- msg('Menu') ^><%- pluralSuffix %><%_ } else { -%><^- msg('Search and menu') ^><%- pluralSuffix %><%_ } -%></h2>
<ul class="list-inline text-right chvrn">
<li><a href="#mb-pnl" title="<%_ if (pr.search == false) { -%><^- msg('Menu') ^><%- pluralSuffix %><%_ } else { -%><^- msg('Search and menu') ^><%- pluralSuffix %><%_ } -%>" aria-controls="mb-pnl" class="overlay-lnk" role="button">
<%_ if (pr.search != false) { -%><span class="glyphicon glyphicon-search"><%_ } -%>
Expand All @@ -199,7 +199,7 @@ if (pr.subTheme === 'eccc') {
</div>
<%_ if (pr.GCToolsModal != true) { -%>
<div id="tools-sm" class="row<%- (pr.intranetTitle != null)? '': ' visible-md' %>">
<section id="tool-container-sm" class="col-md-12 col-sm-12">
<section id="tool-container-sm" class="col-md-12 col-sm-12" aria-label="<^- msg('GCTools links') ^>">
<div class="pull-left tool-link"><a href="<^- msg('https://gcconnex.gc.ca/splash/') ^>" class="<^- msg('GCTBannerOnclick-eng') ^>"><^- msg('<span class="bold-gc">GC</span>connex') ^></a></div>
<div class="pull-left tool-link"><a href="<^- msg('https://www.gcpedia.gc.ca/wiki/?setlang=en') ^>" class="<^- msg('GCTBannerOnclick-eng') ^>"><^- msg('<span class="bold-gc">GC</span>pedia') ^></a></div>
<div class="pull-left tool-link"><a href="<^- msg('https://gcdirectory-gcannuaire.gc.ca/en/GCD/?pgid=002') ^>" class="<^- msg('GCTBannerOnclick-eng') ^>"><^- msg('<span class="bold-gc">GC</span>directory') ^></a></div>
Expand Down Expand Up @@ -251,9 +251,9 @@ if (pr.subTheme === 'eccc') {
</div>
</div>
<%_ if (pr.menuLinks != null) { -%>
<nav role="navigation" id="wb-smapp" data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement">
<nav role="navigation" id="wb-smapp" data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement" aria-labelledby="cdts-mainMenu">
<div class="pnl-strt container nvbar">
<h2 class="wb-inv"><^- msg('Main navigation menu') ^></h2>
<h2 class="wb-inv" aria-labelledby="cdts-mainMenu"><^- msg('Main navigation menu') ^></h2>
<div class="row">
<ul class="list-inline menu" role="menubar">
<%_ for (var menuLinkIndex=0; menuLinkIndex<pr.menuLinks.length; menuLinkIndex++) {
Expand Down Expand Up @@ -289,13 +289,13 @@ if (pr.subTheme === 'eccc') {
</div>
</nav>
<%_ } else if (pr.menuPath != null) { -%>
<nav role="navigation" id="wb-smapp" data-ajax-replace="<%= pr.menuPath %>" data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement"></nav>
<nav role="navigation" id="wb-smapp" data-ajax-replace="<%= pr.menuPath %>" data-trgt="mb-pnl" class="wb-menu visible-md visible-lg" typeof="SiteNavigationElement" aria-label="<^- msg('Application menu') ^>"></nav>
<%_ } else { -%>
<div id="wb-sm" data-ajax-replace="<%- wet.builder.environment(pr.cdnEnv) %>cdts/ajax/<^- msg('appmenu-eng.html') ^>" data-trgt="mb-pnl" class="wb-menu hidden-sm hidden-xs"></div>
<%_ } -%>
<%_ if (pr.breadcrumbs != null) { -%>
<nav role="navigation" id="wb-bc" property="breadcrumb">
<h2><^- msg('You are here:') ^></h2>
<nav role="navigation" id="wb-bc" property="breadcrumb" aria-labelledby="breadcrumbPosition">
<h2 id="breadcrumbPosition"><^- msg('You are here:') ^></h2>
<div class="container">
<ol class="breadcrumb">
<%_ for (var breadcrumbIndex=0; breadcrumbIndex<pr.breadcrumbs.length; breadcrumbIndex++) {
Expand Down
Loading