diff --git a/test/form/dedupes-external-imports/_config.js b/test/form/dedupes-external-imports/_config.js new file mode 100644 index 0000000..ed2bff2 --- /dev/null +++ b/test/form/dedupes-external-imports/_config.js @@ -0,0 +1,6 @@ +module.exports = { + description: 'dedupes external imports', + options: { + external: [ 'external' ] + } +}; diff --git a/test/form/dedupes-external-imports/_expected/amd.js b/test/form/dedupes-external-imports/_expected/amd.js new file mode 100644 index 0000000..be13b6a --- /dev/null +++ b/test/form/dedupes-external-imports/_expected/amd.js @@ -0,0 +1,28 @@ +define(['external'], function (external) { 'use strict'; + + class Foo extends external.Component { + constructor () { + super(); + this.isFoo = true; + } + } + + class Bar extends external.Component { + constructor () { + super(); + this.isBar = true; + } + } + + class Baz extends external.Component { + constructor () { + super(); + this.isBaz = true; + } + } + + const foo = new Foo(); + const bar = new Bar(); + const baz = new Baz(); + +}); diff --git a/test/form/dedupes-external-imports/_expected/cjs.js b/test/form/dedupes-external-imports/_expected/cjs.js new file mode 100644 index 0000000..01dda8c --- /dev/null +++ b/test/form/dedupes-external-imports/_expected/cjs.js @@ -0,0 +1,28 @@ +'use strict'; + +var external = require('external'); + +class Foo extends external.Component { + constructor () { + super(); + this.isFoo = true; + } +} + +class Bar extends external.Component { + constructor () { + super(); + this.isBar = true; + } +} + +class Baz extends external.Component { + constructor () { + super(); + this.isBaz = true; + } +} + +const foo = new Foo(); +const bar = new Bar(); +const baz = new Baz(); diff --git a/test/form/dedupes-external-imports/_expected/es6.js b/test/form/dedupes-external-imports/_expected/es6.js new file mode 100644 index 0000000..884df6d --- /dev/null +++ b/test/form/dedupes-external-imports/_expected/es6.js @@ -0,0 +1,26 @@ +import { Component } from 'external'; + +class Foo extends Component { + constructor () { + super(); + this.isFoo = true; + } +} + +class Bar extends Component { + constructor () { + super(); + this.isBar = true; + } +} + +class Baz extends Component { + constructor () { + super(); + this.isBaz = true; + } +} + +const foo = new Foo(); +const bar = new Bar(); +const baz = new Baz(); diff --git a/test/form/dedupes-external-imports/_expected/iife.js b/test/form/dedupes-external-imports/_expected/iife.js new file mode 100644 index 0000000..2656d84 --- /dev/null +++ b/test/form/dedupes-external-imports/_expected/iife.js @@ -0,0 +1,28 @@ +(function (external) { 'use strict'; + + class Foo extends external.Component { + constructor () { + super(); + this.isFoo = true; + } + } + + class Bar extends external.Component { + constructor () { + super(); + this.isBar = true; + } + } + + class Baz extends external.Component { + constructor () { + super(); + this.isBaz = true; + } + } + + const foo = new Foo(); + const bar = new Bar(); + const baz = new Baz(); + +})(external); diff --git a/test/form/dedupes-external-imports/_expected/umd.js b/test/form/dedupes-external-imports/_expected/umd.js new file mode 100644 index 0000000..49ca55a --- /dev/null +++ b/test/form/dedupes-external-imports/_expected/umd.js @@ -0,0 +1,32 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('external')) : + typeof define === 'function' && define.amd ? define(['external'], factory) : + factory(global.external); +}(this, function (external) { 'use strict'; + + class Foo extends external.Component { + constructor () { + super(); + this.isFoo = true; + } + } + + class Bar extends external.Component { + constructor () { + super(); + this.isBar = true; + } + } + + class Baz extends external.Component { + constructor () { + super(); + this.isBaz = true; + } + } + + const foo = new Foo(); + const bar = new Bar(); + const baz = new Baz(); + +})); diff --git a/test/form/dedupes-external-imports/bar.js b/test/form/dedupes-external-imports/bar.js new file mode 100644 index 0000000..ba19d22 --- /dev/null +++ b/test/form/dedupes-external-imports/bar.js @@ -0,0 +1,8 @@ +import { Component } from 'external'; + +export default class Bar extends Component { + constructor () { + super(); + this.isBar = true; + } +} diff --git a/test/form/dedupes-external-imports/baz.js b/test/form/dedupes-external-imports/baz.js new file mode 100644 index 0000000..e52d4b0 --- /dev/null +++ b/test/form/dedupes-external-imports/baz.js @@ -0,0 +1,8 @@ +import { Component as Comp } from 'external'; + +export default class Baz extends Comp { + constructor () { + super(); + this.isBaz = true; + } +} diff --git a/test/form/dedupes-external-imports/foo.js b/test/form/dedupes-external-imports/foo.js new file mode 100644 index 0000000..0646080 --- /dev/null +++ b/test/form/dedupes-external-imports/foo.js @@ -0,0 +1,8 @@ +import { Component } from 'external'; + +export default class Foo extends Component { + constructor () { + super(); + this.isFoo = true; + } +} diff --git a/test/form/dedupes-external-imports/main.js b/test/form/dedupes-external-imports/main.js new file mode 100644 index 0000000..2fe3164 --- /dev/null +++ b/test/form/dedupes-external-imports/main.js @@ -0,0 +1,7 @@ +import Foo from './foo'; +import Bar from './bar'; +import Baz from './baz'; + +const foo = new Foo(); +const bar = new Bar(); +const baz = new Baz();