Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F996278
markdown.test.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
markdown.test.ts
View Options
import
{
Registry
}
from
"../registry.js"
;
import
{
Markdown
}
from
"./markdown.js"
;
import
{
documentContainerFromParsed
,
makeSimpleEnglishJDDContext
,
render
,
}
from
"../index.js"
;
import
assert
from
"assert"
;
import
{
streamToString
}
from
"tempstream"
;
import
{
FileManager
}
from
"@sealcode/file-manager"
;
import
{
formatWithPrettier
}
from
"../test-utils/prettier.js"
;
describe
(
"markdown component"
,
()
=>
{
it
(
"renders as a part of a JDD"
,
async
()
=>
{
const
document
=
documentContainerFromParsed
([
{
component_name
:
"markdown"
,
args
:
{
markdown
:
`# Hello World`
}
},
{
component_name
:
"markdown"
,
args
:
{
markdown
:
`Multiple components ftw`
},
},
]);
const
registry
=
new
Registry
();
registry
.
add
(
"markdown"
,
Markdown
);
const
result
=
await
render
(
registry
,
document
,
makeSimpleEnglishJDDContext
(
new
FileManager
(
"/tmp"
,
"/uploaded_files"
)
)
);
assert
.
strictEqual
(
await
formatWithPrettier
(
result
,
"html"
),
// note the soft hyphens
await
formatWithPrettier
(
/* HTML */
`<section class="jdd-component component-number-0">
<h1>Hello World</h1>
</section>
<section class="jdd-component component-number-1">
<p>Multiple components ftw</p>
</section>`
,
"html"
)
);
});
});
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Dec 24, 14:02 (20 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557149
Default Alt Text
markdown.test.ts (1 KB)
Attached To
Mode
R130 jdd
Attached
Detach File
Event Timeline
Log In to Comment