Skip to content

Commit 8883be9

Browse files
committed
Dont reference react where it can be compiled
1 parent a8a9cd2 commit 8883be9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

test/generators/coffee_component_generator_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def class_name
3333
end
3434

3535
test 'that it generates working jsx' do
36-
expected_name_div = /React\.createElement\(\s*"div",\s*null,\s*"Name:\s*",\s*this\.props\.name\s*\)/x
37-
expected_shape_div = /React\.createElement\(\s*"div",\s*null,\s*"Address:\s*",\s*this\.props\.address\s*\)/x
36+
expected_name_div = /\.createElement\(\s*"div",\s*null,\s*"Name:\s*",\s*this\.props\.name\s*\)/x
37+
expected_shape_div = /\.createElement\(\s*"div",\s*null,\s*"Address:\s*",\s*this\.props\.address\s*\)/x
3838

3939
run_generator %w(GeneratedComponent name:string address:shape --coffee)
4040
jsx = React::JSX.transform(CoffeeScript.compile(File.read(File.join(destination_root, filename))))

test/generators/component_generator_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def filename
2121

2222
assert_file filename do |contents|
2323
if WebpackerHelpers.available?
24-
assert_match /^var React = require\("react"\)/, contents
24+
assert_match /^import React from "react"/, contents
2525
assert_match /module\.exports = GeneratedComponent\n$/m, contents
2626
end
2727
end
@@ -58,8 +58,8 @@ def filename
5858
end
5959

6060
test 'generates working jsx' do
61-
expected_name_div = /React\.createElement\(\s*"div",\s*null,\s*\"Name:\s*\",\s*this\.props\.name\s*\)/x
62-
expected_shape_div = /React\.createElement\(\s*"div",\s*null,\s*\"Address:\s*\",\s*this\.props\.address\s*\)/x
61+
expected_name_div = /\.createElement\(\s*"div",\s*null,\s*\"Name:\s*\",\s*this\.props\.name\s*\)/x
62+
expected_shape_div = /\.createElement\(\s*"div",\s*null,\s*\"Address:\s*\",\s*this\.props\.address\s*\)/x
6363

6464
run_generator %w(GeneratedComponent name:string address:shape)
6565
jsx = React::JSX.transform(File.read(File.join(destination_root, filename)))

0 commit comments

Comments
 (0)