-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add integration test for spread operator
- Loading branch information
Showing
5 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = "ok"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import X, { A, B } from "./module"; | ||
import * as M from "./module"; | ||
|
||
it("should support spread operator", function() { | ||
var o1 = { ...X }; | ||
o1.should.be.eql({ A: "A", B: "B" }); | ||
var o2 = { ...({ X }) }; | ||
o2.should.be.eql({ X: { A: "A", B: "B" } }); | ||
var o3 = { ...M }; | ||
o3.should.be.eql({ default: { A: "A", B: "B" }, A: "A", B: "B" }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const A = "A"; | ||
const B = "B"; | ||
|
||
export default { A, B }; | ||
|
||
export { A, B }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var supportsSpread = require("../../../helpers/supportsSpread"); | ||
|
||
module.exports = function(config) { | ||
return supportsSpread(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = function supportsSpread() { | ||
try { | ||
var x = { a: true }, y; // eslint-disable-line no-unused-vars | ||
eval("y = { ...x }"); | ||
return y !== x && y.a; | ||
} catch(e) { | ||
return false; | ||
} | ||
}; |