@@ -1439,12 +1439,12 @@ test_that("static rendering", {
14391439 )
14401440 tbl <- expect_and_replace_dataKey(tbl )
14411441 rendered <- htmltools :: renderTags(tbl )
1442- expect_true(grepl( " data-react-ssr" , rendered $ html ) )
1443- expect_true(grepl( " >column-y-cell<" , rendered $ html ) )
1442+ expect_match( rendered $ html , " data-react-ssr" , fixed = TRUE )
1443+ expect_match( rendered $ html , " >column-y-cell<" , fixed = TRUE )
14441444 expect_snapshot(cat(rendered $ html ))
14451445
14461446 # JS evals should always be serialized as an array
1447- expect_true(grepl( ' "evals":[]' , rendered $ html , fixed = TRUE ) )
1447+ expect_match( rendered $ html , ' "evals":[]' , fixed = TRUE )
14481448
14491449 # Themes critical CSS should be included in <head>
14501450 tbl <- reactable(
@@ -1475,8 +1475,8 @@ test_that("static rendering", {
14751475 )
14761476 tbl <- expect_and_replace_dataKey(tbl )
14771477 rendered <- htmltools :: renderTags(tbl )
1478- expect_true(grepl( " js-rendered_2_" , rendered $ html ) )
1479- expect_true(grepl( " <b>column-y-cell</b>" , rendered $ html ) )
1478+ expect_match( rendered $ html , " js-rendered_2_" , fixed = TRUE )
1479+ expect_match( rendered $ html , " <b>column-y-cell</b>" , fixed = TRUE )
14801480 expect_snapshot(cat(rendered $ html ))
14811481
14821482 # Custom render functions and JS evals that call React externally should work
@@ -1490,7 +1490,7 @@ test_that("static rendering", {
14901490 )
14911491 tbl <- expect_and_replace_dataKey(tbl )
14921492 rendered <- htmltools :: renderTags(tbl )
1493- expect_true(grepl( " <b>column-y-cell</b>" , rendered $ html ) )
1493+ expect_match( rendered $ html , " <b>column-y-cell</b>" , fixed = TRUE )
14941494 expect_snapshot(cat(rendered $ html ))
14951495
14961496 # Known limitation: default expanded rows with defaultExpanded = TRUE is not currently supported.
@@ -1503,7 +1503,7 @@ test_that("static rendering", {
15031503 )
15041504 tbl <- expect_and_replace_dataKey(tbl )
15051505 rendered <- htmltools :: renderTags(tbl )
1506- expect_false(grepl( " >row-details<" , rendered $ html ) )
1506+ expect_no_match( rendered $ html , " >row-details<" , fixed = TRUE )
15071507 expect_snapshot_html_with_utf8(rendered $ html )
15081508
15091509 # Embedded HTML widgets' root elements and widget scripts should not be statically rendered
@@ -1517,7 +1517,7 @@ test_that("static rendering", {
15171517 )
15181518 tbl <- expect_and_replace_dataKey(tbl )
15191519 rendered <- htmltools :: renderTags(tbl )
1520- expect_false(grepl( " sparkline " , strsplit(rendered $ html , " <script" )[[1 ]][[1 ]]) )
1520+ expect_no_match( strsplit(rendered $ html , " <script" )[[1 ]][[1 ]], " sparkline " , fixed = TRUE )
15211521 expect_equal(lengths(gregexpr(" <script " , rendered $ html )), 1 ) # Should only be one <script> for reactable
15221522 expect_snapshot(cat(rendered $ html ))
15231523
@@ -1555,17 +1555,17 @@ test_that("static rendering", {
15551555 tbl <- expect_and_replace_dataKey(tbl )
15561556 rendered <- htmltools :: renderTags(tbl )
15571557 html <- rendered $ html
1558- expect_true(grepl( " pre_str_suffix" , html , fixed = TRUE ) )
1559- expect_true(grepl( " >75%<" , html , fixed = TRUE ) )
1560- expect_true(grepl( " >52.9%<" , html , fixed = TRUE ) )
1561- expect_true(grepl( " >$10.00<" , html , fixed = TRUE ) )
1562- expect_true(grepl( " >€11.12<" , html , fixed = TRUE ) )
1563- expect_true(grepl( " >1,234.1<" , html , fixed = TRUE ) )
1564- expect_true(grepl( " >₹1,234,567.40<" , html , fixed = TRUE ) )
1558+ expect_match( html , " pre_str_suffix" , fixed = TRUE )
1559+ expect_match( html , " >75%<" , fixed = TRUE )
1560+ expect_match( html , " >52.9%<" , fixed = TRUE )
1561+ expect_match( html , " >$10.00<" , fixed = TRUE )
1562+ expect_match( html , " >€11.12<" , fixed = TRUE )
1563+ expect_match( html , " >1,234.1<" , fixed = TRUE )
1564+ expect_match( html , " >₹1,234,567.40<" , fixed = TRUE )
15651565 # Date/time formatting depends on the local timezone, which can't easily be controlled in tests
1566- expect_false(grepl( " _date_2019-05-06T03:22:15Z_date_" , html ) )
1566+ expect_no_match( html , " _date_2019-05-06T03:22:15Z_date_" , fixed = TRUE )
15671567 html <- sub(" >_date_.+_date_<" , " >_date_replaced_date_<" , html )
1568- expect_false(grepl( " _time_2019-05-06T03:22:15Z_time_" , html ) )
1568+ expect_no_match( html , " _time_2019-05-06T03:22:15Z_time_" , fixed = TRUE )
15691569 html <- sub(" >_time_.+_time_<" , " >_time_replaced_time_<" , html )
15701570 expect_snapshot_html_with_utf8(html )
15711571
@@ -1578,18 +1578,18 @@ test_that("static rendering", {
15781578 )
15791579 tbl <- expect_and_replace_dataKey(tbl )
15801580 expect_warning({ rendered <- htmltools :: renderTags(tbl ) }, " Failed to render table to static HTML:\n Error: error rendering JS" )
1581- expect_false(grepl( " data-react-ssr" , rendered $ html ) )
1582- expect_false(grepl( " >column-y-cell<" , rendered $ html ) )
1581+ expect_no_match( rendered $ html , " data-react-ssr" , fixed = TRUE )
1582+ expect_no_match( rendered $ html , " >column-y-cell<" , fixed = TRUE )
15831583 expect_snapshot(cat(rendered $ html ))
15841584
15851585 # Custom knit_print method should work
15861586 tbl <- reactable(data , static = TRUE )
15871587 output <- knitr :: knit_print(tbl , options = list (screenshot.force = FALSE ))
1588- expect_true(grepl( " data-react-ssr" , output ) )
1588+ expect_match( output , " data-react-ssr" , fixed = TRUE )
15891589
15901590 tbl <- reactable(data )
15911591 output <- knitr :: knit_print(tbl , options = list (screenshot.force = FALSE ))
1592- expect_false(grepl( " data-react-ssr" , output ) )
1592+ expect_no_match( output , " data-react-ssr" , fixed = TRUE )
15931593})
15941594
15951595test_that(" server-side data" , {
0 commit comments