Trim trailing whitespace from generated sippets.

master v1.1
Pacman Ghost 4 years ago
parent f139404c37
commit bc66eec58f
  1. 3
      vasl_templates/webapp/static/snippets.js
  2. 4
      vasl_templates/webapp/tests/test_extras_templates.py

@ -435,6 +435,9 @@ function make_snippet( $btn, params, extra_params, show_date_warnings )
snippet = strReplaceAll( snippet, "{{USER_FILES}}", APP_URL_BASE+"/user" ) ;
snippet = strReplaceAll( snippet, "{{CHAPTER_H}}", APP_URL_BASE+"/chapter-h" ) ;
// tidy up the final snippet
snippet = snippet.replace( /[^\S\r\n]+$/gm, "" ) ; // nb: trim trailing whitespace
return {
content: snippet,
template_id: template_id,

@ -153,7 +153,7 @@ def test_edit_extras_template( webapp, webdriver ):
# generate the template (we should still be using the old template)
snippet_btn = find_child( "button.generate", content )
snippet_btn.click()
wait_for_clipboard( 2, "param = ", contains=True )
wait_for_clipboard( 2, "param =", contains=True )
# switch to another template, then back again
_select_extras_template( webdriver, "extras/full" )
@ -170,7 +170,7 @@ def test_edit_extras_template( webapp, webdriver ):
# generate the template (we should be using the new template)
snippet_btn = find_child( "button.generate", content )
snippet_btn.click()
wait_for_clipboard( 2, "added = added-val\nparam = ", contains=True )
wait_for_clipboard( 2, "added = added-val\nparam =", contains=True )
# ---------------------------------------------------------------------

Loading…
Cancel
Save