Skip to content

Commit

Permalink
Merge pull request #372 from creativedotdesign/feature/validate-html-…
Browse files Browse the repository at this point in the history
…test-fixes

Feature/validate html test fixes
  • Loading branch information
danimalweb authored Jan 4, 2024
2 parents 92b4395 + e3387c5 commit e6a52e8
Show file tree
Hide file tree
Showing 8 changed files with 192 additions and 7 deletions.
3 changes: 3 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'cypress';
import * as dotenv from 'dotenv';
import setupPlugins from './cypress/plugins/index';
import htmlvalidate from 'cypress-html-validate/plugin';

dotenv.config();

Expand All @@ -12,6 +13,8 @@ export default defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
htmlvalidate.install(on);

setupPlugins(on, config);
},
baseUrl: process.env.VITE_ASSET_URL,
Expand Down
15 changes: 15 additions & 0 deletions cypress/e2e/htmlValidate.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('HTML Validation Tests', () => {
it('should be valid', () => {
cy.task('sitemapLocations').then((pages) => {
pages.forEach((page) => {
cy.visit(page);
cy.htmlvalidate({
rules: {
'require-sri': 'off',
'element-permitted-content': 'off',
},
});
});
});
});
});
1 change: 1 addition & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ import './vue';
import './assertions';
// import './baseUrl';
import './checkElementExists';
import 'cypress-html-validate/commands';
8 changes: 4 additions & 4 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
<?php echo bloginfo('name'); ?>
</a>

<button class="flex lg:hidden js-menu-toggle" aria-controls="main-menu" aria-expanded="false" aria-label="Toggle navigation" data-cy="open-mobile-menu">
<button type="button" class="flex lg:hidden js-menu-toggle" aria-controls="main-menu" aria-expanded="false" aria-label="Toggle navigation" data-cy="open-mobile-menu">
<!-- Hamburger Icon -->
<span class="w-6 h-6">
<?php echo svg(['sprite' => 'icon-hamburger', 'class' => 'w-full h-full']); ?>
<?php echo svg(['sprite' => 'icon-hamburger', 'title' => 'Open Menu', 'class' => 'w-full h-full']); ?>
</span>

<span class="sr-only"><?php _e('Toggle Navigation Button', 'tofino'); ?></span>
</button>

<div class="inactive absolute inset-0 bg-white lg:bg-transparent w-full h-screen lg:h-auto lg:relative lg:w-auto lg:flex lg:items-center" id="main-menu">
<!-- Close Icon -->
<button class="absolute z-10 w-4 h-4 top-5 right-7 lg:hidden js-menu-toggle"
<button type="button" class="absolute z-10 w-4 h-4 top-5 right-7 lg:hidden js-menu-toggle"
data-cy="close-mobile-menu"
>
<?php echo svg(['sprite' => 'icon-close', 'class' => 'w-full h-full']); ?>
<?php echo svg(['sprite' => 'icon-close', 'title' => 'Close Menu', 'class' => 'w-full h-full']); ?>
</button>

<?php if (has_nav_menu('header_navigation')):
Expand Down
2 changes: 1 addition & 1 deletion inc/lib/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function show_maintenance_message()
echo '<div class="error notice"><p><strong>' . __('Maintenance Mode', 'tofino') . '</strong> ' . get_field('maintenance_mode_text', 'general-options') . '</p></div>';

if (!isset($_COOKIE['tofino_maintenance_alert_dismissed'])) {
echo '<div class="maintenance-mode-alert"><h1>' . __('Maintenance Mode', 'tofino') . '</h1><p>' . get_field('maintenance_mode_text', 'general-options') . '</p><button>' . __('I understand', 'tofino') . '</button></div>';
echo '<div class="maintenance-mode-alert"><h1>' . __('Maintenance Mode', 'tofino') . '</h1><p>' . get_field('maintenance_mode_text', 'general-options') . '</p><button type="button">' . __('I understand', 'tofino') . '</button></div>';
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions inc/lib/vite.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ private static function cssTag(string $entry): string
$tags = '';

foreach (self::cssUrls($entry) as $url) {
wp_register_style("tofino/$entry", $url);
wp_enqueue_style("tofino/$entry", $url);
wp_register_style("tofino-" . sanitize_title($entry), $url);
wp_enqueue_style("tofino-" . sanitize_title($entry), $url);
}

return $tags;
Expand Down
165 changes: 165 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"axe-html-reporter": "^2.2.3",
"cypress": "^13.6.2",
"cypress-axe": "^1.5.0",
"cypress-html-validate": "^6.1.0",
"dotenv": "^16.3.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
Expand Down

0 comments on commit e6a52e8

Please sign in to comment.