1
1
import { assert } from '@open-wc/testing'
2
- import '../src/index.ts'
2
+ import { setCSPTrustedTypesPolicy } from '../src/index.ts'
3
3
4
4
let count
5
5
const responses = {
@@ -648,13 +648,11 @@ suite('include-fragment-element', function () {
648
648
649
649
suite ( 'CSP trusted types' , ( ) => {
650
650
teardown ( ( ) => {
651
- // eslint-disable-next-line no-undef
652
651
setCSPTrustedTypesPolicy ( null )
653
652
} )
654
653
655
654
test ( 'can set a pass-through mock CSP trusted types policy' , async function ( ) {
656
655
let policyCalled = false
657
- // eslint-disable-next-line no-undef
658
656
setCSPTrustedTypesPolicy ( {
659
657
createHTML : htmlText => {
660
658
policyCalled = true
@@ -672,7 +670,6 @@ suite('include-fragment-element', function () {
672
670
673
671
test ( 'can set and clear a mutating mock CSP trusted types policy' , async function ( ) {
674
672
let policyCalled = false
675
- // eslint-disable-next-line no-undef
676
673
setCSPTrustedTypesPolicy ( {
677
674
createHTML : ( ) => {
678
675
policyCalled = true
@@ -686,7 +683,6 @@ suite('include-fragment-element', function () {
686
683
assert . equal ( '<b>replacement</b>' , data )
687
684
assert . ok ( policyCalled )
688
685
689
- // eslint-disable-next-line no-undef
690
686
setCSPTrustedTypesPolicy ( null )
691
687
const el2 = document . createElement ( 'include-fragment' )
692
688
el2 . src = '/hello'
@@ -703,7 +699,6 @@ suite('include-fragment-element', function () {
703
699
return htmlText
704
700
}
705
701
} )
706
- // eslint-disable-next-line no-undef
707
702
setCSPTrustedTypesPolicy ( policy )
708
703
709
704
const el = document . createElement ( 'include-fragment' )
@@ -714,7 +709,6 @@ suite('include-fragment-element', function () {
714
709
} )
715
710
716
711
test ( 'can reject data using a mock CSP trusted types policy' , async function ( ) {
717
- // eslint-disable-next-line no-undef
718
712
setCSPTrustedTypesPolicy ( {
719
713
createHTML : ( ) => {
720
714
throw new Error ( 'Rejected data!' )
@@ -732,7 +726,6 @@ suite('include-fragment-element', function () {
732
726
} )
733
727
734
728
test ( 'can access headers using a mock CSP trusted types policy' , async function ( ) {
735
- // eslint-disable-next-line no-undef
736
729
setCSPTrustedTypesPolicy ( {
737
730
createHTML : ( htmlText , response ) => {
738
731
if ( response . headers . get ( 'X-Server-Sanitized' ) !== 'sanitized=true' ) {
0 commit comments