Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(mutant-id): escape html in mutant attributes (#2070)
- Loading branch information
Showing
11 changed files
with
4,965 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { expect } from 'chai'; | ||
import { getCurrent } from './lib/browser'; | ||
import { MutantMarker } from './po/MutantMarker.po'; | ||
import { ReportPage } from './po/ReportPage'; | ||
|
||
describe('Unsanitized example', () => { | ||
let page: ReportPage; | ||
|
||
beforeEach(() => { | ||
page = new ReportPage(getCurrent()); | ||
}); | ||
|
||
describe('mutant view', () => { | ||
beforeEach(async () => { | ||
await page.navigateTo('unsanitized-example/#mutant/platform.ts'); | ||
}); | ||
|
||
it('should escape quotes in mutant ids', async () => { | ||
const mutantMarkers = await page.mutantView.mutantMarkers(); | ||
let m: MutantMarker | undefined; | ||
for (const mutantMarker of mutantMarkers) { | ||
const mutantId = await mutantMarker.mutantId(); | ||
if (mutantId === 'src/platform.ts@7:31-7:38\nStringLiteral: ""') { | ||
m = mutantMarker; | ||
break; | ||
} | ||
} | ||
expect(m).ok; | ||
await m!.toggle(); | ||
expect(await page.mutantView.mutantDrawer().whenHalfOpen()).eq(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/elements/testResources/unsanitized-example/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Test files example - Mutation test elements</title> | ||
<script src="/mutation-test-elements.js"></script> | ||
<meta name="viewport" content="width=device-width, initial-scale=0.5" /> | ||
</head> | ||
|
||
<body> | ||
<a href="/">Back</a> | ||
<mutation-test-report-app src="mutation-report.json"></mutation-test-report-app> | ||
<script> | ||
const app = document.getElementsByTagName('mutation-test-report-app').item(0); | ||
function updateTheme() { | ||
document.body.style.backgroundColor = app.themeBackgroundColor; | ||
} | ||
app.addEventListener('theme-changed', updateTheme); | ||
updateTheme(); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.