mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
fix problems with html style comments in embedded code (#160981)
* fix problems with html style comments in embedded code * add spacings to the replaced characters add same amount of characters, in the replacements so that all offsets stays the same * revert javascriptMode.ts * add replace characters in embeddedSupport.ts instead * added few more tests with javascript more testcases with js code before and after the comments * polish Co-authored-by: UwUeeb <106700035+UwUeeb@users.noreply.github.com> Co-authored-by: Martin Aeschlimann <martinae@microsoft.com>
This commit is contained in:
@@ -119,7 +119,10 @@ suite('HTML Embedded Support', () => {
|
||||
test('Script content', function (): any {
|
||||
assertEmbeddedLanguageContent('<html><script>var i = 0;</script></html>', 'javascript', ' var i = 0; ');
|
||||
assertEmbeddedLanguageContent('<script type="text/javascript">var i = 0;</script>', 'javascript', ' var i = 0; ');
|
||||
assertEmbeddedLanguageContent('<script><!--this comment should not give error--></script>', 'javascript', ' /* this comment should not give error */ ');
|
||||
assertEmbeddedLanguageContent('<script><!--this comment should not give error--> console.log("logging");</script>', 'javascript', ' /* this comment should not give error */ console.log("logging"); ');
|
||||
|
||||
assertEmbeddedLanguageContent('<script>var data=100; <!--this comment should not give error--> </script>', 'javascript', ' var data=100; /* this comment should not give error */ ');
|
||||
assertEmbeddedLanguageContent('<div onKeyUp="foo()" onkeydown="bar()"/>', 'javascript', ' foo(); bar(); ');
|
||||
assertEmbeddedLanguageContent('<div onKeyUp="return"/>', 'javascript', ' return; ');
|
||||
assertEmbeddedLanguageContent('<div onKeyUp=return\n/><script>foo();</script>', 'javascript', ' return;\n foo(); ');
|
||||
|
||||
Reference in New Issue
Block a user