Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(interactive-examples): grant clipboard-write permission to iframe #10910

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kumascript/macros/EmbedInteractiveExample.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ const text = mdn.localStringMap({

%>
<h2><%=text["title"]%></h2>
<iframe class="interactive <%= heightClass %>" height="200" src="<%= url %>" title="MDN Web Docs Interactive Example"></iframe>
<iframe class="interactive <%= heightClass %>" height="200" src="<%= url %>" title="MDN Web Docs Interactive Example" allow="clipboard-write"></iframe>
10 changes: 5 additions & 5 deletions kumascript/tests/macros/EmbedInteractiveExample.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describeMacro("EmbedInteractiveExample", function () {
return assert.eventually.equal(
macro.call("pages/css/animation.html"),
`<h2>Try it</h2>
<iframe class="interactive is-default-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/css/animation.html" title="MDN Web Docs Interactive Example"></iframe>`
<iframe class="interactive is-default-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/css/animation.html" title="MDN Web Docs Interactive Example" allow="clipboard-write"></iframe>`
);
});
itMacro("Changes in settings and argument are reflected", function (macro) {
Expand All @@ -18,7 +18,7 @@ describeMacro("EmbedInteractiveExample", function () {
return assert.eventually.equal(
macro.call("pages/http/headers.html"),
`<h2>Try it</h2>
<iframe class="interactive is-default-height" height="200" src="https://www.fleetwood-mac.com/pages/http/headers.html" title="MDN Web Docs Interactive Example"></iframe>`
<iframe class="interactive is-default-height" height="200" src="https://www.fleetwood-mac.com/pages/http/headers.html" title="MDN Web Docs Interactive Example" allow="clipboard-write"></iframe>`
);
});
itMacro(
Expand All @@ -30,7 +30,7 @@ describeMacro("EmbedInteractiveExample", function () {
return assert.eventually.equal(
macro.call("/pages/css/animation.html"),
`<h2>Try it</h2>
<iframe class="interactive is-default-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/css/animation.html" title="MDN Web Docs Interactive Example"></iframe>`
<iframe class="interactive is-default-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/css/animation.html" title="MDN Web Docs Interactive Example" allow="clipboard-write"></iframe>`
);
}
);
Expand All @@ -41,7 +41,7 @@ describeMacro("EmbedInteractiveExample", function () {
return assert.eventually.equal(
macro.call("pages/js/expressions-conditionaloperators.html"),
`<h2>Try it</h2>
<iframe class="interactive is-js-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/js/expressions-conditionaloperators.html" title="MDN Web Docs Interactive Example"></iframe>`
<iframe class="interactive is-js-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/js/expressions-conditionaloperators.html" title="MDN Web Docs Interactive Example" allow="clipboard-write"></iframe>`
);
});
itMacro("An extra class can be passed as an argument", function (macro) {
Expand All @@ -51,7 +51,7 @@ describeMacro("EmbedInteractiveExample", function () {
return assert.eventually.equal(
macro.call("pages/http/headers.html", "taller"),
`<h2>Try it</h2>
<iframe class="interactive is-taller-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/http/headers.html" title="MDN Web Docs Interactive Example"></iframe>`
<iframe class="interactive is-taller-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/http/headers.html" title="MDN Web Docs Interactive Example" allow="clipboard-write"></iframe>`
);
});
});