Skip to content

Commit

Permalink
Clean up createDocument helper
Browse files Browse the repository at this point in the history
  • Loading branch information
afcapel committed Sep 22, 2022
1 parent 2033c81 commit 74cfe53
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/test/test_helpers/fixtures/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,12 @@ export { TEST_IMAGE_URL }
const { css } = config

const createDocument = function (...parts) {
const blocks = (() => {
const result = []

Array.from(parts).forEach((part) => {
const [ string, textAttributes, blockAttributes ] = Array.from(part)
const text = Text.textForStringWithAttributes(string, textAttributes)
result.push(new Block(text, blockAttributes))
})
const blocks = parts.map((part) => {
const [ string, textAttributes, blockAttributes ] = Array.from(part)
const text = Text.textForStringWithAttributes(string, textAttributes)
return new Block(text, blockAttributes)
})

return result
})()
return new Document(blocks)
}

Expand Down

0 comments on commit 74cfe53

Please sign in to comment.