@@ -1787,37 +1787,36 @@ describe("parser", () => {
17871787 } ) ;
17881788
17891789 [ 0 , false , "" , NaN ] . forEach ( ( falsyValue ) => {
1790- "should not overwrite $prop scope properties when assigning" ,
1791- ( ) => {
1792- let scope ;
1793-
1794- scope = { a : falsyValue , c : falsyValue } ;
1795- tryParseAndIgnoreException ( "a.b = 1" ) ;
1796- tryParseAndIgnoreException ( 'c["d"] = 2' ) ;
1797- expect ( scope ) . toEqual ( { a : falsyValue , c : falsyValue } ) ;
1798-
1799- scope = { a : { b : falsyValue , c : falsyValue } } ;
1800- tryParseAndIgnoreException ( "a.b.c = 1" ) ;
1801- tryParseAndIgnoreException ( 'a.c["d"] = 2' ) ;
1802- expect ( scope ) . toEqual ( { a : { b : falsyValue , c : falsyValue } } ) ;
1803-
1804- // Helpers
1805- //
1806- // Normally assigning property on a primitive should throw exception in strict mode
1807- // and silently fail in non-strict mode, IE seems to always have the non-strict-mode behavior,
1808- // so if we try to use 'expect(() => {$parse('a.b=1')({a:false});).toThrow()' for testing
1809- // the test will fail in case of IE because it will not throw exception, and if we just use
1810- // '$parse('a.b=1')({a:false})' the test will fail because it will throw exception in case of Chrome
1811- // so we use tryParseAndIgnoreException helper to catch the exception silently for all cases.
1812- //
1813- function tryParseAndIgnoreException ( expression ) {
1814- try {
1815- $parse ( expression ) ( scope ) ;
1816- } catch ( error ) {
1817- /* ignore exception */
1818- }
1790+ it ( "should not overwrite $prop scope properties when assigning" , ( ) => {
1791+ let scope ;
1792+
1793+ scope = { a : falsyValue , c : falsyValue } ;
1794+ tryParseAndIgnoreException ( "a.b = 1" ) ;
1795+ tryParseAndIgnoreException ( 'c["d"] = 2' ) ;
1796+ expect ( scope ) . toEqual ( { a : falsyValue , c : falsyValue } ) ;
1797+
1798+ scope = { a : { b : falsyValue , c : falsyValue } } ;
1799+ tryParseAndIgnoreException ( "a.b.c = 1" ) ;
1800+ tryParseAndIgnoreException ( 'a.c["d"] = 2' ) ;
1801+ expect ( scope ) . toEqual ( { a : { b : falsyValue , c : falsyValue } } ) ;
1802+
1803+ // Helpers
1804+ //
1805+ // Normally assigning property on a primitive should throw exception in strict mode
1806+ // and silently fail in non-strict mode, IE seems to always have the non-strict-mode behavior,
1807+ // so if we try to use 'expect(() => {$parse('a.b=1')({a:false});).toThrow()' for testing
1808+ // the test will fail in case of IE because it will not throw exception, and if we just use
1809+ // '$parse('a.b=1')({a:false})' the test will fail because it will throw exception in case of Chrome
1810+ // so we use tryParseAndIgnoreException helper to catch the exception silently for all cases.
1811+ //
1812+ function tryParseAndIgnoreException ( expression ) {
1813+ try {
1814+ $parse ( expression ) ( scope ) ;
1815+ } catch ( error ) {
1816+ /* ignore exception */
18191817 }
1820- } ;
1818+ }
1819+ } ) ;
18211820 } ) ;
18221821 } ) ;
18231822
0 commit comments