1- testthat :: describe(" modify_last_chunk_outputs_attributes " , {
1+ testthat :: describe(" set_chunk_attrs " , {
22 card <- teal.reporter :: teal_card(
33 " # Header" ,
44 " Some text" ,
@@ -7,41 +7,41 @@ testthat::describe("modify_last_chunk_outputs_attributes", {
77 )
88
99 it(" changes last chunk output with default parameters" , {
10- new_card <- modify_last_chunk_outputs_attributes (card , list (dev.height = 200 ))
10+ new_card <- set_chunk_attrs (card , list (dev.height = 200 ))
1111 testthat :: expect_equal(attributes(new_card [[4 ]]), list (class = " chunk_output" , dev.height = 200 ))
1212 testthat :: expect_equal(attributes(new_card [[3 ]]), list (class = " chunk_output" ))
1313 })
1414
1515 it(" changes last 2 chunks" , {
16- new_card <- modify_last_chunk_outputs_attributes (card , list (dev.height = 200 ), n = 2 )
16+ new_card <- set_chunk_attrs (card , list (dev.height = 200 ), n = 2 )
1717 testthat :: expect_equal(attributes(new_card [[4 ]]), list (class = " chunk_output" , dev.height = 200 ))
1818 testthat :: expect_equal(attributes(new_card [[3 ]]), list (class = " chunk_output" , dev.height = 200 ))
1919 })
2020
2121 it(" only changes the numeric chunk_outputs" , {
22- new_card <- modify_last_chunk_outputs_attributes (card , list (dev.height = 200 ), n = 2 , inner_classes = " numeric" )
22+ new_card <- set_chunk_attrs (card , list (dev.height = 200 ), n = 2 , inner_classes = " numeric" )
2323 testthat :: expect_equal(attributes(new_card [[3 ]]), list (class = " chunk_output" , dev.height = 200 ))
2424 testthat :: expect_equal(attributes(new_card [[4 ]]), list (class = " chunk_output" ))
2525 })
2626
2727 it(" throws warning when last chunk is not chunk_output" , {
2828 testthat :: expect_warning(
29- modify_last_chunk_outputs_attributes (c(card , " yada" ), list (new_attr = TRUE )),
29+ set_chunk_attrs (c(card , " yada" ), list (new_attr = TRUE )),
3030 " The last element of the `teal_card` is not a `chunk_output` object. No attributes were modified."
3131 )
3232 })
3333
3434 it(" throws warning when second to last chunk is not chunk_output" , {
3535 card_modified <- c(card [c(1 , 2 , 3 )], " bla" , card [[4 ]])
3636 testthat :: expect_warning(
37- modify_last_chunk_outputs_attributes (card_modified , n = 3 , list (new_attr = TRUE )),
37+ set_chunk_attrs (card_modified , n = 3 , list (new_attr = TRUE )),
3838 " The 2 to last element of the `teal_card` is not a `chunk_output` object. Skipping any further modifications."
3939 )
4040 })
4141
4242 it(" modifies all elements up until the first non-chunk output" , {
4343 card_modified <- c(card [c(1 , 2 , 3 )], " bla" , card [[4 ]])
44- new_card <- modify_last_chunk_outputs_attributes (card_modified , n = 3 , list (new_attr = TRUE ), quiet = TRUE )
44+ new_card <- set_chunk_attrs (card_modified , n = 3 , list (new_attr = TRUE ), quiet = TRUE )
4545 testthat :: expect_equal(attributes(new_card [[5 ]]), list (class = " chunk_output" , new_attr = TRUE ))
4646 testthat :: expect_null(attributes(new_card [[4 ]]))
4747 testthat :: expect_equal(attributes(new_card [[3 ]]), list (class = " chunk_output" ))
0 commit comments