Skip to content

Commit

Permalink
fixed insideAttribute test
Browse files Browse the repository at this point in the history
  • Loading branch information
alselawi committed May 8, 2020
1 parent ec63993 commit 82a44ce
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions test/a_unit/is-inside-attr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,25 @@ const attributesThatCanHaveURL = [
"action",
"longdesc",
"classid",
"archive"
"archive",
"other",
"non-standard",
];

describe("UNIT: is inside attribute", () => {
describe("Positive", () => {
attributesThatCanHaveURL.forEach(attr => {
attributesThatCanHaveURL.forEach((attr) => {
it(`${attr} with "`, () => {
expect(isInsideAttribute(`"`, `${attr}="`)).toBe(true);
expect(isInsideAttribute(` ${attr}="`)).toBe(true);
});
it(`${attr} with '`, () => {
expect(isInsideAttribute(`'`, `${attr}='`)).toBe(true);
expect(isInsideAttribute(` ${attr}='`)).toBe(true);
});
});
});
describe("Negative", () => {
it("not preceded with a quote", () => {
expect(isInsideAttribute("'", `src=`)).toBe(false);
});

it("not not an attribute", () => {
expect(isInsideAttribute("'", `abc='`)).toBe(false);
expect(isInsideAttribute(` src=`)).toBe(false);
});
});
});

0 comments on commit 82a44ce

Please sign in to comment.