summaryrefslogtreecommitdiff
path: root/test/indent/js-jsx.js
diff options
context:
space:
mode:
authorJackson Ray Hamilton <jackson@jacksonrayhamilton.com>2015-10-30 23:55:24 -0700
committerJackson Ray Hamilton <jackson@jacksonrayhamilton.com>2015-10-31 13:02:36 -0700
commit958da7ff63d1d647f45fd649654136da78529324 (patch)
treed971bf4c54fef8741bf4f11912508f4dd40162cb /test/indent/js-jsx.js
parent65a3808fcf0afbd90d3ae512ff1ae4395bb2ee69 (diff)
downloademacs-958da7ff63d1d647f45fd649654136da78529324.tar.gz
emacs-958da7ff63d1d647f45fd649654136da78529324.tar.bz2
emacs-958da7ff63d1d647f45fd649654136da78529324.zip
Add JSX indentation via js-jsx-mode. (Bug#21799)
* progmodes/js.el: Add JSX indentation support. (js-jsx-indent-line) (js-jsx-mode): New functions.
Diffstat (limited to 'test/indent/js-jsx.js')
-rw-r--r--test/indent/js-jsx.js85
1 files changed, 85 insertions, 0 deletions
diff --git a/test/indent/js-jsx.js b/test/indent/js-jsx.js
new file mode 100644
index 00000000000..7401939d282
--- /dev/null
+++ b/test/indent/js-jsx.js
@@ -0,0 +1,85 @@
+// -*- mode: js-jsx; -*-
+
+var foo = <div></div>;
+
+return (
+ <div>
+ </div>
+ <div>
+ <div></div>
+ <div>
+ <div></div>
+ </div>
+ </div>
+);
+
+React.render(
+ <div>
+ <div></div>
+ </div>,
+ {
+ a: 1
+ },
+ <div>
+ <div></div>
+ </div>
+);
+
+return (
+ // Sneaky!
+ <div></div>
+);
+
+return (
+ <div></div>
+ // Sneaky!
+);
+
+React.render(
+ <input
+ />,
+ {
+ a: 1
+ }
+);
+
+return (
+ <div>
+ {array.map(function () {
+ return {
+ a: 1
+ };
+ })}
+ </div>
+);
+
+return (
+ <div attribute={array.map(function () {
+ return {
+ a: 1
+ };
+
+ return {
+ a: 1
+ };
+
+ return {
+ a: 1
+ };
+ })}>
+ </div>
+);
+
+// Local Variables:
+// indent-tabs-mode: nil
+// js-indent-level: 2
+// End:
+
+// The following test has intentionally unclosed elements and should
+// be placed below all other tests to prevent awkward indentation.
+
+return (
+ <div>
+ {array.map(function () {
+ return {
+ a: 1