11beforeEach ( function ( ) {
2- global . disableOptInFeatures ( ) ;
2+ global . resetFeatures ( ) ;
33 global . addToEqualMatchMatcher ( ) ;
44} ) ;
55
@@ -445,27 +445,27 @@ describe('XRegExp.exec()', function() {
445445 // for the RegExp.prototype.exec and nonglobal String.prototype.match specs...
446446
447447 it ( 'should include named capture properties on the match array if namespacing is not installed' , function ( ) {
448+ XRegExp . uninstall ( 'namespacing' ) ;
448449 var match = XRegExp . exec ( 'a' , XRegExp ( '(?<name>a)' ) ) ;
449450
450451 expect ( match . name ) . toBe ( 'a' ) ;
451452 expect ( match [ 1 ] ) . toBe ( 'a' ) ;
452453 } ) ;
453454
454455 it ( 'should not include named capture properties on the match array if namespacing is installed' , function ( ) {
455- XRegExp . install ( 'namespacing' ) ;
456456 var match = XRegExp . exec ( 'a' , XRegExp ( '(?<name>a)' ) ) ;
457457
458458 expect ( match . name ) . toBeUndefined ( ) ;
459459 } ) ;
460460
461461 it ( 'should not include named capture properties on a groups object if namespacing is not installed' , function ( ) {
462+ XRegExp . uninstall ( 'namespacing' ) ;
462463 var match = XRegExp . exec ( 'a' , XRegExp ( '(?<name>a)' ) ) ;
463464
464465 expect ( match . groups ) . toBeUndefined ( ) ;
465466 } ) ;
466467
467468 it ( 'should include named capture properties on a groups object if namespacing is installed' , function ( ) {
468- XRegExp . install ( 'namespacing' ) ;
469469 var match = XRegExp . exec ( 'a' , XRegExp ( '(?<name>a)' ) ) ;
470470
471471 expect ( match . groups . name ) . toBe ( 'a' ) ;
@@ -736,7 +736,9 @@ describe('XRegExp.globalize()', function() {
736736
737737describe ( 'XRegExp.install()' , function ( ) {
738738
739- // NOTE: All optional features are uninstalled before each spec runs
739+ beforeEach ( function ( ) {
740+ XRegExp . uninstall ( 'namespacing astral' ) ;
741+ } ) ;
740742
741743 var features = [ 'namespacing' , 'astral' ] ;
742744
@@ -1100,14 +1102,14 @@ describe('XRegExp.matchChain()', function() {
11001102 } ) ;
11011103
11021104 it ( 'should handle named and numbered backrefs when namespacing is not installed' , function ( ) {
1105+ XRegExp . uninstall ( 'namespacing' ) ;
11031106 expect ( XRegExp . matchChain ( 'test' , [
11041107 { regex : / .( ..) / , backref : 1 } ,
11051108 { regex : XRegExp ( '.(?<n>.)' ) , backref : 'n' }
11061109 ] ) ) . toEqual ( [ 's' ] ) ;
11071110 } ) ;
11081111
11091112 it ( 'should handle named and numbered backrefs when namespacing is installed' , function ( ) {
1110- XRegExp . install ( 'namespacing' ) ;
11111113 expect ( XRegExp . matchChain ( 'test' , [
11121114 { regex : / .( ..) / , backref : 1 } ,
11131115 { regex : XRegExp ( '.(?<n>.)' ) , backref : 'n' }
@@ -1186,14 +1188,14 @@ describe('XRegExp.replace()', function() {
11861188 } ) ;
11871189
11881190 it ( 'should not pass the groups argument to callbacks when namespacing is not installed' , function ( ) {
1191+ XRegExp . uninstall ( 'namespacing' ) ;
11891192 var regex = XRegExp ( '(?s)(?<groupName>.)' ) ;
11901193 XRegExp . replace ( 'test' , regex , function ( match , capture1 , pos , str , groups ) {
11911194 expect ( groups ) . toBeUndefined ( ) ;
11921195 } ) ;
11931196 } ) ;
11941197
11951198 it ( 'should pass the groups argument to callbacks when namespacing is installed' , function ( ) {
1196- XRegExp . install ( 'namespacing' ) ;
11971199 var regex = XRegExp ( '(?s)(?<groupName>.)' ) ;
11981200 var groupsObject = Object . create ( null ) ;
11991201 groupsObject . groupName = 't' ;
@@ -1203,13 +1205,13 @@ describe('XRegExp.replace()', function() {
12031205 } ) ;
12041206
12051207 it ( 'should allow accessing named backreferences in callbacks as properties of the first argument when namespacing is not installed' , function ( ) {
1208+ XRegExp . uninstall ( 'namespacing' ) ;
12061209 expect ( XRegExp . replace ( 'abc' , XRegExp ( '(?<name>.).' ) , function ( match ) {
12071210 return ':' + match . name + ':' ;
12081211 } ) ) . toBe ( ':a:c' ) ;
12091212 } ) ;
12101213
12111214 it ( 'should not allow accessing named backreferences in callbacks as properties of the first argument when namespacing is installed' , function ( ) {
1212- XRegExp . install ( 'namespacing' ) ;
12131215 expect ( XRegExp . replace ( 'abc' , XRegExp ( '(?<name>.).' ) , function ( match ) {
12141216 return ':' + match . name + ':' ;
12151217 } ) ) . toBe ( ':undefined:c' ) ;
0 commit comments