test(browser): add regression coverage
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { buildRoleSnapshotFromAriaSnapshot } from "./pw-role-snapshot.js";
|
||||
import {
|
||||
buildRoleSnapshotFromAriaSnapshot,
|
||||
getRoleSnapshotStats,
|
||||
} from "./pw-role-snapshot.js";
|
||||
|
||||
describe("pw-role-snapshot", () => {
|
||||
it("adds refs for interactive elements", () => {
|
||||
@@ -42,4 +45,14 @@ describe("pw-role-snapshot", () => {
|
||||
expect(res.snapshot).toContain(" - group");
|
||||
expect(res.snapshot).not.toContain("button");
|
||||
});
|
||||
|
||||
it("computes stats", () => {
|
||||
const aria = ['- button "OK"', '- button "Cancel"'].join("\n");
|
||||
const res = buildRoleSnapshotFromAriaSnapshot(aria);
|
||||
const stats = getRoleSnapshotStats(res.snapshot, res.refs);
|
||||
expect(stats.refs).toBe(2);
|
||||
expect(stats.interactive).toBe(2);
|
||||
expect(stats.lines).toBeGreaterThan(0);
|
||||
expect(stats.chars).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user