Skip to content

Commit

Permalink
Test for formatting
Browse files Browse the repository at this point in the history
Closes #578
  • Loading branch information
bitwiseman committed Jan 27, 2016
1 parent ae1efd6 commit c567d37
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions js/test/generated/beautify-javascript-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,15 @@ function run_javascript_tests(test_obj, Urlencoded, js_beautify, html_beautify,
' }\n' +
' else script.onload = callback;\n' +
'}');

// Issue 578 - Odd indenting after function
bt(
'function bindAuthEvent(eventName) {\n' +
' self.auth.on(eventName, function(event, meta) {\n' +
' self.emit(eventName, event, meta);\n' +
' });\n' +
'}\n' +
'["logged_in", "logged_out", "signed_up", "updated_user"].forEach(bindAuthEvent);');



Expand Down
9 changes: 9 additions & 0 deletions python/jsbeautifier/tests/generated/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,15 @@ def unicode_char(value):
' }\n' +
' else script.onload = callback;\n' +
'}')

# Issue 578 - Odd indenting after function
bt(
'function bindAuthEvent(eventName) {\n' +
' self.auth.on(eventName, function(event, meta) {\n' +
' self.emit(eventName, event, meta);\n' +
' });\n' +
'}\n' +
'["logged_in", "logged_out", "signed_up", "updated_user"].forEach(bindAuthEvent);')

# Old tests
self.options.brace_style = 'collapse'
Expand Down
11 changes: 11 additions & 0 deletions test/data/javascript/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,17 @@ exports.test_data = {
'}'
]
},
{
comment: "Issue 578 - Odd indenting after function",
unchanged: [
'function bindAuthEvent(eventName) {',
' self.auth.on(eventName, function(event, meta) {',
' self.emit(eventName, event, meta);',
' });',
'}',
'["logged_in", "logged_out", "signed_up", "updated_user"].forEach(bindAuthEvent);',
]
},
// {
// comment: "Issue #338 - Short expressions ",
// unchanged: [
Expand Down

0 comments on commit c567d37

Please sign in to comment.