Changeset 52010 for trunk/tests/phpunit/tests/formatting/escJs.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/escJs.php
r51623 r52010 5 5 */ 6 6 class Tests_Formatting_EscJs extends WP_UnitTestCase { 7 function test_js_escape_simple() {7 public function test_js_escape_simple() { 8 8 $out = esc_js( 'foo bar baz();' ); 9 9 $this->assertSame( 'foo bar baz();', $out ); 10 10 } 11 11 12 function test_js_escape_quotes() {12 public function test_js_escape_quotes() { 13 13 $out = esc_js( 'foo "bar" \'baz\'' ); 14 14 // Does it make any sense to change " into "? Why not \"? … … 16 16 } 17 17 18 function test_js_escape_backslash() {18 public function test_js_escape_backslash() { 19 19 $bs = '\\'; 20 20 $out = esc_js( 'foo ' . $bs . 't bar ' . $bs . $bs . ' baz' ); … … 23 23 } 24 24 25 function test_js_escape_amp() {25 public function test_js_escape_amp() { 26 26 $out = esc_js( 'foo & bar &baz; ' ); 27 27 $this->assertSame( 'foo & bar &baz; ', $out ); 28 28 } 29 29 30 function test_js_escape_quote_entity() {30 public function test_js_escape_quote_entity() { 31 31 $out = esc_js( 'foo ' bar ' baz &' ); 32 32 $this->assertSame( "foo \\' bar \\' baz &", $out ); 33 33 } 34 34 35 function test_js_no_carriage_return() {35 public function test_js_no_carriage_return() { 36 36 $out = esc_js( "foo\rbar\nbaz\r" ); 37 37 // \r is stripped. … … 39 39 } 40 40 41 function test_js_escape_rn() {41 public function test_js_escape_rn() { 42 42 $out = esc_js( "foo\r\nbar\nbaz\r\n" ); 43 43 // \r is stripped.
Note: See TracChangeset
for help on using the changeset viewer.