@@ -5,3 +5,50 @@ test_that("`args_js` returns correct output", {
55
66 expect_equal(args , " , a: 'one', b: 'two'" )
77})
8+
9+ test_that(" `args_js` correctly remaps class to className" , {
10+ args <- args_js(class = " my-class" )
11+
12+ expect_equal(args , " , class: 'my-class', className: 'my-class'" )
13+ })
14+
15+ test_that(" `define_key` correctly defines a key" , {
16+ key <- define_key(" mykey" )
17+
18+ expect_equal(key , " cellInfo.row.mykey" )
19+ })
20+
21+ test_that(" `define_key` correctly defines a key when key is null" , {
22+ key <- define_key(NULL )
23+
24+ expect_equal(key , paste(
25+ " cellInfo.row['.internal_uuid'] ?" ,
26+ " cellInfo.row['.internal_uuid'] :" ,
27+ " (Number(cellInfo.id) + 1)"
28+ ))
29+ })
30+
31+ test_that(" `dropdown_extra` sets choices to blank when length is 0" , {
32+ choices <- build_dropdown_extra_choices(character (0 ))
33+
34+ expect_equal(choices , " " )
35+ })
36+
37+ test_that(" `dropdown_extra` sets choices correctly" , {
38+ choices <- build_dropdown_extra_choices(letters [1 : 3 ])
39+
40+ expect_equal(choices , " , choices: [\" a\" ,\" b\" ,\" c\" ]" )
41+ })
42+
43+ test_that(" expect tooltip to return JS_EVAL object" , {
44+ expect_s3_class(tooltip_extra(" This is my tool-tip" , theme = " material" ), " JS_EVAL" )
45+ })
46+
47+ test_that(" expect inputs to return JS_EVAL object" , {
48+ expect_s3_class(button_extra(" button" ), " JS_EVAL" )
49+ expect_s3_class(checkbox_extra(" checkbox" ), " JS_EVAL" )
50+ expect_s3_class(date_extra(" date" ), " JS_EVAL" )
51+ expect_s3_class(dropdown_extra(" dropdown" , letters [1 : 3 ]), " JS_EVAL" )
52+ expect_s3_class(text_extra(" text" ), " JS_EVAL" )
53+ expect_s3_class(button_extra(" button" ), " JS_EVAL" )
54+ })
0 commit comments