|
| 1 | +import purgeTsx from "../src/index"; |
| 2 | + |
| 3 | +import { TEST_1_CONTENT, TEST_1_TAG, TEST_1_CLASS, TEST_1_ID } from "./data"; |
| 4 | + |
| 5 | +const plugin = purgeTsx(); |
| 6 | + |
| 7 | +describe("purgeTsx", () => { |
| 8 | + describe("from a normal html document", () => { |
| 9 | + it("finds tag selectors", () => { |
| 10 | + const received = plugin(TEST_1_CONTENT); |
| 11 | + for (const item of TEST_1_TAG) { |
| 12 | + expect(received.includes(item)).toBe(true); |
| 13 | + } |
| 14 | + }); |
| 15 | + |
| 16 | + it("finds classes selectors", () => { |
| 17 | + const received = plugin(TEST_1_CONTENT); |
| 18 | + for (const item of TEST_1_CLASS) { |
| 19 | + expect(received.includes(item)).toBe(true); |
| 20 | + } |
| 21 | + }); |
| 22 | + |
| 23 | + it("finds id selectors", () => { |
| 24 | + const received = plugin(TEST_1_CONTENT); |
| 25 | + for (const item of TEST_1_ID) { |
| 26 | + expect(received.includes(item)).toBe(true); |
| 27 | + } |
| 28 | + }); |
| 29 | + |
| 30 | + it("finds all selectors", () => { |
| 31 | + const received = plugin(TEST_1_CONTENT); |
| 32 | + const selectors = [...TEST_1_TAG, ...TEST_1_CLASS, ...TEST_1_ID]; |
| 33 | + for (const item of selectors) { |
| 34 | + expect(received.includes(item)).toBe(true); |
| 35 | + } |
| 36 | + }); |
| 37 | + }); |
| 38 | +}); |
0 commit comments