This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/unit/lib/text-test.js
Joffrey JAFFEUX 7476c22324
DEV: implements parseAsync in discourse/lib/text (#17899)
`parseAsync` allows to parse a block of markdown into tokens.

Usage:

```javascript
import { parseAsync } from "discourse/lib/text";

// ...

await parseAsync("**test**").then((tokens) => {
 console.log(tokens);
})
```
2022-08-13 14:25:32 +02:00

15 lines
382 B
JavaScript

import { module, test } from "qunit";
import { parseAsync } from "discourse/lib/text";
module("Unit | Utility | text", function () {
test("parseAsync", async function (assert) {
await parseAsync("**test**").then((tokens) => {
assert.strictEqual(
tokens[1].children[1].type,
"strong_open",
"it parses the raw markdown"
);
});
});
});