Skip to content
This repository has been archived by the owner on Feb 5, 2018. It is now read-only.

Commit

Permalink
fix(regex): do not treat it as note if there are texts after keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
stevemao committed Aug 6, 2016
1 parent ea32582 commit 9cb56bc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function getNotesRegex(noteKeywords) {
return reNomatch;
}

return new RegExp('^\\s*(' + join(noteKeywords, '|') + ')[:\\s]*(.*)', 'i');
return new RegExp('^\\s*(' + join(noteKeywords, '|') + ')[:\\s]+(.*)', 'i');
}

function getReferencePartsRegex(issuePrefixes) {
Expand Down
24 changes: 24 additions & 0 deletions test/parser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,30 @@ describe('parser', function() {
});
});

it('should not treat it as important notes if there are texts after `noteKeywords`', function() {
options.noteKeywords = ['BREAKING CHANGE'];
reg = regex(options);
var msg = parser(
'fix(core): report duplicate template bindings in templates\n' +
'\n' +
'Fixes #7315\n' +
'\n' +
'BREAKING CHANGES:\n' +
'\n' +
'Previously multiple template bindings on one element\n' +
'(ex. `<div *ngIf=\'..\' *ngFor=\'...\'>`) were allowed but most of the time\n' +
'were leading to undesired result. It is possible that a small number\n' +
'of applications will see template parse errors that shuld be fixed by\n' +
'nesting elements or using `<template>` tags explicitly.\n' +
'\n' +
'Closes #9462',
options,
reg
);

expect(msg.notes).to.eql([]);
});

it('references should be empty if not found', function() {
expect(simpleMsg.references).to.eql([]);
});
Expand Down

0 comments on commit 9cb56bc

Please sign in to comment.