@@ -23,11 +23,10 @@ import {
|
||||
} from 'angular2/src/change_detection/parser/ast';
|
||||
|
||||
|
||||
import {StringWrapper, RegExpWrapper, isPresent, isString} from 'angular2/src/facade/lang';
|
||||
|
||||
var quoteRegExp = RegExpWrapper.create('"');
|
||||
import {StringWrapper, isPresent, isString} from 'angular2/src/facade/lang';
|
||||
|
||||
export class Unparser implements AstVisitor {
|
||||
private static _quoteRegExp = /"/g;
|
||||
private _expression: string;
|
||||
|
||||
unparse(ast: AST) {
|
||||
@@ -151,7 +150,7 @@ export class Unparser implements AstVisitor {
|
||||
|
||||
visitLiteralPrimitive(ast: LiteralPrimitive) {
|
||||
if (isString(ast.value)) {
|
||||
this._expression += `"${StringWrapper.replaceAll(ast.value, quoteRegExp, '\"')}"`;
|
||||
this._expression += `"${StringWrapper.replaceAll(ast.value, Unparser._quoteRegExp, '\"')}"`;
|
||||
} else {
|
||||
this._expression += `${ast.value}`;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
export function main() {
|
||||
describe('RegExp', () => {
|
||||
it('should expose the index for each match', () => {
|
||||
var re = RegExpWrapper.create('(!)');
|
||||
var re = /(!)/g;
|
||||
var matcher = RegExpWrapper.matcher(re, '0!23!567!!');
|
||||
var indexes = [];
|
||||
var m;
|
||||
|
||||
@@ -20,7 +20,7 @@ export function main() {
|
||||
function s(css: string, contentAttr: string, hostAttr: string = '') {
|
||||
var shadowCss = new ShadowCss();
|
||||
var shim = shadowCss.shimCssText(css, contentAttr, hostAttr);
|
||||
var nlRegexp = RegExpWrapper.create('\\n');
|
||||
var nlRegexp = /\n/g;
|
||||
return normalizeCSS(StringWrapper.replaceAll(shim, nlRegexp, ''));
|
||||
}
|
||||
|
||||
@@ -61,8 +61,7 @@ export function main() {
|
||||
isPresent(DOM.defaultDoc().body.style.animationName)) {
|
||||
it('should handle keyframes rules', () => {
|
||||
var css = '@keyframes foo {0% {transform: translate(-50%) scaleX(0);}}';
|
||||
var passRe = RegExpWrapper.create(
|
||||
'@keyframes foo {\\s*0% {\\s*transform:translate\\(-50%\\) scaleX\\(0\\);\\s*}\\s*}');
|
||||
var passRe = /@keyframes foo {\s*0% {\s*transform:translate\(-50%\) scaleX\(0\);\s*}\s*}/g;
|
||||
expect(RegExpWrapper.test(passRe, s(css, 'a'))).toEqual(true);
|
||||
});
|
||||
}
|
||||
@@ -70,8 +69,8 @@ export function main() {
|
||||
if (DOM.getUserAgent().indexOf('AppleWebKit') > -1) {
|
||||
it('should handle -webkit-keyframes rules', () => {
|
||||
var css = '@-webkit-keyframes foo {0% {-webkit-transform: translate(-50%) scaleX(0);}}';
|
||||
var passRe = RegExpWrapper.create(
|
||||
'@-webkit-keyframes foo {\\s*0% {\\s*(-webkit-)*transform:translate\\(-50%\\) scaleX\\(0\\);\\s*}}');
|
||||
var passRe =
|
||||
/@-webkit-keyframes foo {\s*0% {\s*(-webkit-)*transform:translate\(-50%\) scaleX\(0\);\s*}}/g;
|
||||
expect(RegExpWrapper.test(passRe, s(css, 'a'))).toEqual(true);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user