File tree Expand file tree Collapse file tree
static/tests/backend/specs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,9 +15,11 @@ describe(__filename, function () {
1515
1616 it ( 'registers a setInterval that calls refreshRelativeDates (#154)' , function ( ) {
1717 // Any cadence works, but the interval must actually be scheduled so the
18- // relative-time strings update without a page reload.
19- assert ( / s e t I n t e r v a l \( [ ^ ) ] * r e f r e s h R e l a t i v e D a t e s [ ^ ) ] * \) / . test ( src ) ,
20- 'init should call setInterval(() => this.refreshRelativeDates(), ...)' ) ;
18+ // relative-time strings update without a page reload. A one-line regex
19+ // can't reliably parse nested parens (`setInterval(() => ...)`), so
20+ // just require the two identifiers to live in the same statement.
21+ const stmt = src . match ( / s e t I n t e r v a l [ \s \S ] * ?r e f r e s h R e l a t i v e D a t e s [ \s \S ] * ?\) ; / ) ;
22+ assert ( stmt , 'init should schedule setInterval(() => this.refreshRelativeDates(), ...)' ) ;
2123 } ) ;
2224
2325 it ( 'refreshRelativeDates recomputes text from the datetime attribute (#154)' ,
You can’t perform that action at this time.
0 commit comments