Adding tests for Escape nodes

This commit is contained in:
Jeff Avallone
2014-12-19 21:49:11 -05:00
parent 32a28ede90
commit 24e21834f6
2 changed files with 83 additions and 6 deletions
+7 -6
View File
@@ -4,8 +4,8 @@ export default {
type: 'escape',
_render() {
return this.renderLabel(_.result(this, this.code))
.then(label => {
return this.renderLabel(this.label)
.tap(label => {
label.select('rect').attr({
rx: 3,
ry: 3
@@ -16,6 +16,7 @@ export default {
setup() {
this.code = this.properties.esc.properties.code.textValue;
this.arg = this.properties.esc.properties.arg.textValue;
this.label = _.result(this, this.code);
},
// Escape code mappings
@@ -43,18 +44,18 @@ export default {
9: 'Back reference (group = 9)',
0() {
if (this.arg) {
return 'octal: ' + this.arg;
return `octal: ${this.arg}`;
} else {
return 'null';
}
},
c() {
return 'ctrl-' + this.arg;
return `ctrl-${this.arg}`;
},
x() {
return '0x' + this.arg.toUpperCase();
return `0x${this.arg.toUpperCase()}`;
},
u() {
return 'U+' + this.arg.toUpperCase();
return `U+${this.arg.toUpperCase()}`;
}
};