2021-04-04 18:03:05 +02:00
|
|
|
import test from 'ava'
|
|
|
|
import { JSDOM } from 'jsdom'
|
2021-01-08 14:08:40 +01:00
|
|
|
|
2021-05-03 21:39:23 +02:00
|
|
|
import { createAnchorElement } from './html-creator'
|
|
|
|
|
|
|
|
let document
|
2021-01-08 14:08:40 +01:00
|
|
|
|
|
|
|
test.beforeEach(() => {
|
2021-05-03 21:39:23 +02:00
|
|
|
document = new JSDOM().window.document
|
2021-01-08 14:08:40 +01:00
|
|
|
})
|
|
|
|
|
2021-04-05 18:23:37 +02:00
|
|
|
test('#createAnchorElement usual parameters', t => {
|
2021-05-03 21:39:23 +02:00
|
|
|
const a = createAnchorElement({ document, text: 'a', url: 'b' })
|
2021-01-08 14:08:40 +01:00
|
|
|
t.is(a.tagName, 'A')
|
|
|
|
t.is(a.innerHTML, 'a')
|
2021-04-05 17:53:47 +02:00
|
|
|
t.is(a.getAttribute('href'), 'b')
|
2021-01-08 14:08:40 +01:00
|
|
|
})
|