Skip to content

Commit 196a084

Browse files
committed
Add tests for non-reference point amp-mega-menu markup
1 parent da10be2 commit 196a084

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

tests/php/test-tag-and-attribute-sanitizer.php

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,6 +2437,85 @@ class="gallery"
24372437
[ 'amp-mega-menu' ],
24382438
],
24392439

2440+
'amp-mega-menu-with-template' => [
2441+
'
2442+
<amp-mega-menu height="60" layout="fixed-height">
2443+
<amp-list
2444+
height="350"
2445+
layout="fixed-height"
2446+
src="/static/samples/json/product-single-item.json"
2447+
single-item>
2448+
<template type="amp-mustache">
2449+
<nav>
2450+
<ul>
2451+
{{#values}} <li>
2452+
<h4 role="button">{{name}}</h4>
2453+
<div role="dialog">
2454+
<amp-img
2455+
src="{{img}}"
2456+
width="320"
2457+
height="213"></amp-img>
2458+
<p>Price: $<b>{{price}}</b></p>
2459+
</div>
2460+
</li>
2461+
{{/values}} </ul>
2462+
</nav>
2463+
</template>
2464+
</amp-list>
2465+
</amp-mega-menu>
2466+
',
2467+
null,
2468+
[ 'amp-mega-menu', 'amp-list', 'amp-mustache' ],
2469+
],
2470+
2471+
'amp-mega-menu-disallowed-descendants' => [
2472+
'
2473+
<amp-mega-menu height="30" layout="fixed-height">
2474+
<nav>
2475+
<ul>
2476+
<li>
2477+
<span role="button">List</span>
2478+
<div role="dialog">
2479+
<details><summary>Not</summary> allowed</details>
2480+
</div>
2481+
</li>
2482+
<li>
2483+
<a href="https://amp.dev/">Link</a>
2484+
</li>
2485+
</ul>
2486+
</nav>
2487+
</amp-mega-menu>
2488+
',
2489+
'
2490+
<amp-mega-menu height="30" layout="fixed-height">
2491+
<nav>
2492+
<ul>
2493+
<li>
2494+
<span role="button">List</span>
2495+
<div role="dialog"></div>
2496+
</li>
2497+
<li>
2498+
<a href="https://amp.dev/">Link</a>
2499+
</li>
2500+
</ul>
2501+
</nav>
2502+
</amp-mega-menu>
2503+
',
2504+
[ 'amp-mega-menu' ],
2505+
[ AMP_Tag_And_Attribute_Sanitizer::DISALLOWED_DESCENDANT_TAG ],
2506+
],
2507+
2508+
'amp-mega-menu-invalid-child' => [
2509+
'
2510+
<amp-mega-menu height="30" layout="fixed-height">
2511+
<div>Not allowed</div>
2512+
</amp-mega-menu>
2513+
',
2514+
'',
2515+
[],
2516+
[ AMP_Tag_And_Attribute_Sanitizer::DISALLOWED_CHILD_TAG ],
2517+
],
2518+
24402519
'amp-nested-menu' => [
24412520
'
24422521
<button on="tap:sidebar1">Open Sidebar</button>

0 commit comments

Comments
 (0)