CoffeeScript 2 support for JSX (React only, it seems), with test

This commit is contained in:
Geoffrey Booth
2017-10-15 19:37:19 -07:00
parent fd483c34e3
commit 7a7c8f4656
2 changed files with 13 additions and 1 deletions

View File

@@ -22,7 +22,10 @@ export class CoffeeScriptCompiler {
// prevents CoffeeScript projects from using the modules package and
// putting require or import statements within backticks; it just
// won't happen automatically because of Babel.
runtime: false
runtime: false,
// CoffeeScript 2 supports for JSX, which Meteor supports only for React,
// per packages/ecmascript/plugin.js.
react: true
});
}

View File

@@ -28,3 +28,12 @@ Tinytest.add "coffeescript - import local module via native import statement", (
import { testingForNativeImportedModule123456789 } from "./coffeescript_module.coffee";
Tinytest.add "coffeescript - import local module exported by a CoffeeScript native export statement, via native import statement", (test) ->
test.isTrue testingForNativeImportedModule123456789?
# JSX
Tinytest.add "coffeescript - JSX", (test) ->
# Mock React
React =
createElement: (tag, attributes, body) ->
"<#{tag}>#{body}</#{tag}>"
test.isTrue <div>Hello from JSX!</div> is '<div>Hello from JSX!</div>'