-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5fbcbb
commit 5695e1d
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
packages/ckeditor5-bbcode/__tests__/BBCodeListItem.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { asHTMLElement, requireHTMLElement } from "./DOMUtils"; | ||
import { bbCodeListItem } from "../src"; | ||
|
||
describe("BBCodeListItem", () => { | ||
describe("Default Configuration", () => { | ||
const rule = bbCodeListItem; | ||
|
||
it.each` | ||
dataView | expected | ||
${`<li>TEXT</li>`} | ${`[*] TEXT\n`} | ||
`( | ||
"$[$#] Should process '$dataView' to '$expected'", | ||
({ dataView, expected }: { dataView: string; expected: string | undefined }) => { | ||
const embeddedInListDataView = `<ul>${dataView}</ul>`; | ||
const listElement = requireHTMLElement(embeddedInListDataView); | ||
const element = asHTMLElement(listElement.firstElementChild); | ||
if (!element) { | ||
throw new Error(`Test setup error: Could not find the required <li> element: ${embeddedInListDataView}.`); | ||
} | ||
const content = element.textContent ?? ""; | ||
const bbCode = rule.toData(element, content); | ||
expect(bbCode).toEqual(expected); | ||
}, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters