Merge pull request #13023 from calixteman/fix_color_test
Fix integration test with js-colors
This commit is contained in:
commit
052db45e7a
@ -638,7 +638,7 @@ describe("Interaction", () => {
|
|||||||
pages = await loadAndWait("js-colors.pdf", "#\\33 4R");
|
pages = await loadAndWait("js-colors.pdf", "#\\33 4R");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("must changes colors", async () => {
|
it("must change colors", async () => {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
pages.map(async ([browserName, page]) => {
|
pages.map(async ([browserName, page]) => {
|
||||||
for (const [name, ref] of [
|
for (const [name, ref] of [
|
||||||
@ -651,29 +651,36 @@ describe("Interaction", () => {
|
|||||||
await page.type("#\\33 4R", `${name}`, {
|
await page.type("#\\33 4R", `${name}`, {
|
||||||
delay: 10,
|
delay: 10,
|
||||||
});
|
});
|
||||||
await page.click("[data-annotation-id='41R']");
|
|
||||||
let color = await page.$eval(
|
|
||||||
ref,
|
|
||||||
el => getComputedStyle(el).backgroundColor
|
|
||||||
);
|
|
||||||
expect(color)
|
|
||||||
.withContext(`In ${browserName}`)
|
|
||||||
.toEqual("rgb(255, 0, 0)");
|
|
||||||
|
|
||||||
await page.click("[data-annotation-id='43R']");
|
for (const [id, propName, expected] of [
|
||||||
color = await page.$eval(ref, el => getComputedStyle(el).color);
|
[41, "backgroundColor", "rgb(255, 0, 0)"],
|
||||||
expect(color)
|
[43, "color", "rgb(0, 255, 0)"],
|
||||||
.withContext(`In ${browserName}`)
|
[44, "border-top-color", "rgb(0, 0, 255)"],
|
||||||
.toEqual("rgb(0, 255, 0)");
|
]) {
|
||||||
|
const current = await page.$eval(
|
||||||
|
ref,
|
||||||
|
(el, _propName) => getComputedStyle(el)[_propName],
|
||||||
|
propName
|
||||||
|
);
|
||||||
|
|
||||||
await page.click("[data-annotation-id='44R']");
|
await page.click(`[data-annotation-id='${id}R']`);
|
||||||
color = await page.$eval(
|
await page.waitForFunction(
|
||||||
ref,
|
(_ref, _current, _propName) =>
|
||||||
el => getComputedStyle(el)["border-top-color"]
|
getComputedStyle(document.querySelector(_ref))[_propName] !==
|
||||||
);
|
_current,
|
||||||
expect(color)
|
{},
|
||||||
.withContext(`In ${browserName}`)
|
ref,
|
||||||
.toEqual("rgb(0, 0, 255)");
|
current,
|
||||||
|
propName
|
||||||
|
);
|
||||||
|
|
||||||
|
const color = await page.$eval(
|
||||||
|
ref,
|
||||||
|
(el, _propName) => getComputedStyle(el)[_propName],
|
||||||
|
propName
|
||||||
|
);
|
||||||
|
expect(color).withContext(`In ${browserName}`).toEqual(expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user