Skip to content

Commit

Permalink
normalize_line_endings
Browse files Browse the repository at this point in the history
  • Loading branch information
jrosell committed Sep 18, 2024
1 parent 1d72ee9 commit 4b90a0c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/testthat/test-extra-tags.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


test_that('style_tpl_css_vars_replace works tpl_replace for one tpl variable', {
result <- style_tpl_css_vars_replace("me { background: var(--tpl-bgurl) center}", bgurl = "url(/icon.png)")
expected <- "me { background: url(/icon.png) center}"
Expand All @@ -16,7 +18,13 @@ test_that('style_from_css_tpl works', {
as.character(style_from_css_tpl(temp_css_file, bgurl = "url(/icon.png)"))
})
expected <- "<style> me { background: url(/icon.png) center}\n </style>"
expect_equal(result, expected)
normalize_line_endings <- \(text) {
gsub("\r\n|\n|\r", "\n", text)
}
expect_equal(
normalize_line_endings(result),
normalize_line_endings(expected)
)
})

test_that('script_tpl_js_vars_replace works', {
Expand Down

0 comments on commit 4b90a0c

Please sign in to comment.