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

chore(macros): remove page macro #11356

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
27 changes: 0 additions & 27 deletions kumascript/macros/page.ejs

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@
and some from other pages.
-->

<h2 id="Flexbox">Flexbox</h2>
<p>{{ EmbedLiveSample('Flex_1', '300', '200', "", "Learn/CSS/CSS_layout/Introduction/Flex") }}</p>
<p>{{ EmbedLiveSample('Flex_2', '300', '200', "", "Learn/CSS/CSS_layout/Introduction/Flex") }}</p>

<h2 id="Grid_Layout">Grid Layout</h2>
<p>{{ EmbedLiveSample('Grid_1', '300', '330', "", "Learn/CSS/CSS_layout/Introduction/Grid") }}</p>
<div id="Grid_2">
<div class="hidden">
<h6 id="Grid_example_2">Grid example 2</h6>
Expand Down
74 changes: 0 additions & 74 deletions testing/tests/headless.index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,80 +44,6 @@ test.describe("Basic viewing of functional pages", () => {
).toBeTruthy();
});

test("open the /en-US/docs/Learn/CSS/CSS_layout/Introduction page", async ({
page,
}) => {
const uri = "/en-US/docs/Learn/CSS/CSS_layout/Introduction";
const flexSample1Uri = liveSampleURL(`${uri}/Flex`, "flex_1", true);
const flexSample2Uri = liveSampleURL(`${uri}/Flex`, "flex_2", true);
const gridSample1Uri = liveSampleURL(`${uri}/Grid`, "grid_1", true);
const gridSample2Uri = liveSampleURL(uri, "grid_2");
await page.goto(testURL(uri));
expect(await page.title()).toContain("A Test Introduction to CSS layout");
expect(await page.innerText("h1")).toBe(
"A Test Introduction to CSS layout"
);
expect(await page.innerText("#flexbox")).toBe("Flexbox");
expect(
await page.isVisible(`iframe.sample-code-frame[src$="${flexSample1Uri}"]`)
).toBeTruthy();
expect(
await page.isVisible(`iframe.sample-code-frame[src$="${flexSample2Uri}"]`)
).toBeTruthy();
expect(await page.innerText("#grid_layout")).toBe("Grid Layout");
expect(
await page.isVisible(`iframe.sample-code-frame[src$="${gridSample1Uri}"]`)
).toBeTruthy();
expect(
await page.innerText("#grid_2 pre.css.notranslate:not(.hidden)")
).toMatch(/\.wrapper\s*\{\s*display:\s*grid;/);
expect(
await page.isVisible(`iframe.sample-code-frame[src$="${gridSample2Uri}"]`)
).toBeTruthy();

// Ensure that the legacy live-sample pages were built.
for (const sampleUri of [flexSample1Uri, flexSample2Uri, gridSample1Uri]) {
await page.goto(testURL(sampleUri));
expect(await page.innerText("body > div.wrapper > div.box1")).toBe("One");
expect(await page.innerText("body > div.wrapper > div.box2")).toBe("Two");
expect(await page.innerText("body > div.wrapper > div.box3")).toBe(
"Three"
);
}
});

test("open the /en-US/docs/Learn/CSS/CSS_layout/Introduction/Flex page", async ({
page,
}) => {
const uri = "/en-US/docs/Learn/CSS/CSS_layout/Introduction/Flex";
const flexSample1Uri = liveSampleURL(uri, "flex_1");
const flexSample2Uri = liveSampleURL(uri, "flex_2");
await page.goto(testURL(uri));
expect(await page.title()).toContain(
"A Test Introduction to CSS Flexbox Layout"
);
expect(await page.innerText("h1")).toBe(
"A Test Introduction to CSS Flexbox Layout"
);
expect(await page.innerText("#flexbox")).toBe("Flexbox");

expect(
await page.innerText("#flex_1 pre.css.notranslate:not(.hidden)")
).toMatch(/\.wrapper\s*\{\s*display:\s*flex;\s*\}/);
expect(
await page.isVisible(`iframe.sample-code-frame[src$="${flexSample1Uri}"]`)
).toBeTruthy();

expect(
await page.innerText("#flex_2 pre.css.notranslate:not(.hidden)")
).toMatch(
/\.wrapper {\s*display: flex;\s*\}\s*\.wrapper > div \{\s*flex: 1;\s*\}/
);
expect(
await page.isVisible(`iframe.sample-code-frame[src$="${flexSample2Uri}"]`)
).toBeTruthy();
});

test("open the /en-US/docs/Learn/CSS/CSS_layout/Introduction/Grid page", async ({
page,
}) => {
Expand Down
21 changes: 0 additions & 21 deletions testing/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -908,27 +908,6 @@ test("check built flaws for /en-us/learn/css/css_layout/introduction/grid page",
expect(doc.flaws).toEqual({});
});

test("check built flaws for /en-us/learn/css/css_layout/introduction/flex page", () => {
expect(fs.existsSync(buildRoot)).toBeTruthy();
const builtFolder = path.join(
buildRoot,
"en-us",
"docs",
"learn",
"css",
"css_layout",
"introduction",
"flex"
);
expect(fs.existsSync(builtFolder)).toBeTruthy();

const htmlFile = path.join(builtFolder, "index.html");
const html = fs.readFileSync(htmlFile, "utf-8");
const $ = cheerio.load(html);
// The css_layout/introduction/flex page has 2 iframes
expect($('iframe[loading="lazy"]')).toHaveLength(2);
});

test("detect bad_bcd_queries flaws", () => {
const builtFolder = path.join(
buildRoot,
Expand Down