@@ -38,7 +38,7 @@ class JSXTransformTest < ActionDispatch::IntegrationTest
3838 assert_equal EXPECTED_JS_2 . gsub ( /\s / , '' ) , @response . body . gsub ( /\s / , '' )
3939 end
4040
41- test 'can use dropped in version of JSX transformer' do
41+ test 'can use dropped- in version of JSX transformer' do
4242 hidden_path = File . expand_path ( "../dummy/vendor/assets/react/JSXTransformer__.js" , __FILE__ )
4343 replacing_path = File . expand_path ( "../dummy/vendor/assets/react/JSXTransformer.js" , __FILE__ )
4444
@@ -51,4 +51,20 @@ class JSXTransformTest < ActionDispatch::IntegrationTest
5151 assert_response :success
5252 assert_equal 'test_confirmation_token_jsx_transformed;' , @response . body
5353 end
54+
55+ test 'accepts harmony: true option' do
56+ React ::JSX . transform_options = { harmony : true }
57+ get '/assets/harmony_example.js'
58+ assert_response :success
59+ assert_match ( /generateGreeting:\s *function\( \) / , @response . body , "object literal methods" )
60+ assert_match ( /React.__spread/ , @response . body , "spreading props" )
61+ assert_match ( /Your greeting is: '" \+ insertedGreeting \+ "'/ , @response . body , "string interpolation" )
62+ end
63+
64+ test 'accepts strip_types: true option' do
65+ React ::JSX . transform_options = { strip_types : true , harmony : true }
66+ get '/assets/flow_types_example.js'
67+ assert_response :success
68+ assert_match ( /\( i\s *,\s *name\s *\) \s *\{ / , @response . body , "type annotations are removed" )
69+ end
5470end
0 commit comments