diff --git a/lib/config.js b/lib/config.js index 2a15cbb..b44d879 100644 --- a/lib/config.js +++ b/lib/config.js @@ -37,7 +37,7 @@ module.exports = async options => { } if (options.data) { - newOptions.data = options.isFragment ? createDocument(options.data) : options.data + newOptions.data = options.isFragment ? createDocument(options.data, options.language ?? 'en') : options.data newOptions.method = 'post' if (!newOptions.headers['Content-Type']) { newOptions.headers['Content-Type'] = 'text/html; charset=utf-8' diff --git a/lib/create-document-from-fragment.js b/lib/create-document-from-fragment.js index d9cbf1d..8a70da9 100644 --- a/lib/create-document-from-fragment.js +++ b/lib/create-document-from-fragment.js @@ -1 +1 @@ -module.exports = fragment => `
This is a fragment
' - const document = createDocument(fragment) + const document = createDocument(fragment, 'en') const expectedDocument = 'This is a fragment
' tap.equal(document, expectedDocument, 'document is correct') test.end()