MNT Test for customScript sri attributes appended

This commit is contained in:
Finlay Metcalfe 2023-11-23 11:07:39 +13:00
parent 33569f2dc2
commit 6e89070490
1 changed files with 8 additions and 0 deletions

View File

@ -1403,6 +1403,7 @@ EOS
$this->setupRequirements($backend);
$backend->javascript('javascript/RequirementsTest_a.js', ['integrity' => 'abc', 'crossorigin' => 'use-credentials']);
$backend->customScript("//TEST", null, ['type' => 'module', 'crossorigin' => 'anonymous']);
$backend->css('css/RequirementsTest_a.css', null, ['integrity' => 'def', 'crossorigin' => 'anonymous']);
$html = $backend->includeInHTML(self::$html_template);
@ -1413,6 +1414,13 @@ EOS
'javascript has correct sri attributes'
);
/* Custom Javascript has correct attribute */
$this->assertMatchesRegularExpression(
'#<script type="module" crossorigin="anonymous"#',
$html,
'custom javascript has correct sri attributes'
);
/* CSS has correct attributes */
$this->assertMatchesRegularExpression(
'#<link .*href=".*/RequirementsTest_a\.css.*" integrity="def" crossorigin="anonymous"#',