Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Add tests for on attribute handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mjangda committed Feb 19, 2016
1 parent 2fa5817 commit 7b44417
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test-amp-blacklist-sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ public function get_data() {
'<a href="/path/to/file.jpg">Link</a>'
),

'on_attribute' => array(
'onclick_attribute' => array(
'<a href="/path/to/file.jpg" onclick="alert(e);">Link</a>',
'<a href="/path/to/file.jpg">Link</a>'
),

'on_attribute' => array(
'<button on="tap:my-lightbox">Tap Me</button>',
'<button on="tap:my-lightbox">Tap Me</button>'
),

'multiple_blacklisted_attributes' => array(
'<a href="/path/to/file.jpg" style="border: 1px solid red;" onclick="alert(e);">Link</a>',
'<a href="/path/to/file.jpg">Link</a>',
Expand Down
5 changes: 5 additions & 0 deletions tests/test-amp-img-sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public function get_data() {
'<amp-img src="http://placehold.it/350x150" width="350" height="150" alt="Placeholder!" sizes="(min-width: 350px) 350px, 100vw" class="amp-wp-enforced-sizes"></amp-img>',
),

'image_with_on_attribute' => array(
'<img src="http://placehold.it/350x150" on="tap:my-lightbox" />',
'<amp-img src="http://placehold.it/350x150" on="tap:my-lightbox"></amp-img>',
),

'image_with_blacklisted_attribute' => array(
'<img src="http://placehold.it/350x150" style="border: 1px solid red;" />',
'<amp-img src="http://placehold.it/350x150"></amp-img>',
Expand Down

0 comments on commit 7b44417

Please sign in to comment.