Cleanup and simplify JS code
Change-Id: I393e22763c1a1d18878026bf459b747b150429fb
diff --git a/dev/js/spec/vcSpec.js b/dev/js/spec/vcSpec.js
index 4f7c7dc..89bd897 100644
--- a/dev/js/spec/vcSpec.js
+++ b/dev/js/spec/vcSpec.js
@@ -607,7 +607,7 @@
expect(docGroup.getOperand(1).ldType()).toEqual("non");
var op = docGroup.getOperand(1).element().lastChild;
- expect(op.getAttribute('class')).toEqual('operators');
+ expect(op.getAttribute('class')).toEqual('operators button-group');
expect(op.children[0].getAttribute('class')).toEqual('delete');
expect(op.children.length).toEqual(1);
@@ -618,7 +618,7 @@
expect(docGroup.getOperand(1).value()).toEqual("");
op = docGroup.getOperand(1).element().lastChild;
- expect(op.getAttribute('class')).toEqual('operators');
+ expect(op.getAttribute('class')).toEqual('operators button-group');
expect(op.children[0].getAttribute('class')).toEqual('and');
expect(op.children[1].getAttribute('class')).toEqual('or');
expect(op.children[2].getAttribute('class')).toEqual('delete');
@@ -648,7 +648,7 @@
expect(vc.root().ldType()).toEqual("doc");
op = vc.root().element().lastChild;
- expect(op.getAttribute('class')).toEqual('operators');
+ expect(op.getAttribute('class')).toEqual('operators button-group');
expect(op.children[0].getAttribute('class')).toEqual('and');
expect(op.children[1].getAttribute('class')).toEqual('or');
expect(op.children[2].getAttribute('class')).toEqual('delete');
@@ -776,7 +776,7 @@
expect(e.children[0].getAttribute('class')).toEqual('doc');
var docop = e.children[0].lastChild;
- expect(docop.getAttribute('class')).toEqual('operators');
+ expect(docop.getAttribute('class')).toEqual('operators button-group');
expect(docop.children[0].getAttribute('class')).toEqual('and');
expect(docop.children[1].getAttribute('class')).toEqual('or');
expect(docop.children[2].getAttribute('class')).toEqual('delete');
@@ -786,13 +786,13 @@
// This and-operation can be "or"ed or "delete"d
var secop = e.children[1].children[2];
- expect(secop.getAttribute('class')).toEqual('operators');
+ expect(secop.getAttribute('class')).toEqual('operators button-group');
expect(secop.children[0].getAttribute('class')).toEqual('or');
expect(secop.children[1].getAttribute('class')).toEqual('delete');
// This or-operation can be "and"ed or "delete"d
- expect(e.children[2].getAttribute('class')).toEqual('operators');
- expect(e.lastChild.getAttribute('class')).toEqual('operators');
+ expect(e.children[2].getAttribute('class')).toEqual('operators button-group');
+ expect(e.lastChild.getAttribute('class')).toEqual('operators button-group');
expect(e.lastChild.children[0].getAttribute('class')).toEqual('and');
expect(e.lastChild.children[1].getAttribute('class')).toEqual('delete');
});
@@ -944,8 +944,8 @@
expect(dg.getAttribute('class')).toEqual('docGroup');
expect(dg.children[0].getAttribute('class')).toEqual('doc');
expect(dg.children[1].getAttribute('class')).toEqual('doc');
- expect(dg.children[2].getAttribute('class')).toEqual('operators');
- expect(vc.element().firstChild.children[2].getAttribute('class')).toEqual('operators');
+ expect(dg.children[2].getAttribute('class')).toEqual('operators button-group');
+ expect(vc.element().firstChild.children[2].getAttribute('class')).toEqual('operators button-group');
});
it('should be modifiable by deletion in flat docGroups', function () {
@@ -1205,7 +1205,7 @@
expect(op.del()).toBeTruthy();
var e = op.element();
- expect(e.getAttribute('class')).toEqual('operators');
+ expect(e.getAttribute('class')).toEqual('operators button-group');
expect(e.children[0].getAttribute('class')).toEqual('or');
expect(e.children[0].firstChild.data).toEqual('or');
expect(e.children[1].getAttribute('class')).toEqual('delete');
@@ -1216,7 +1216,7 @@
op.update();
e = op.element();
- expect(e.getAttribute('class')).toEqual('operators');
+ expect(e.getAttribute('class')).toEqual('operators button-group');
expect(e.children[0].getAttribute('class')).toEqual('and');
expect(e.children[0].firstChild.data).toEqual('and');
expect(e.children[1].getAttribute('class')).toEqual('or');
@@ -1264,7 +1264,7 @@
"type": 'type:date'
});
expect(vc.root().toQuery()).toEqual('pubDate in 2014-12-05');
- expect(vc.root().element().lastChild.getAttribute('class')).toEqual('operators');
+ expect(vc.root().element().lastChild.getAttribute('class')).toEqual('operators button-group');
// Clean with delete from root
expect(vc.root().element().lastChild.lastChild.getAttribute('class')).toEqual('delete');
@@ -1440,7 +1440,7 @@
// Operands and operators
expect(vc.element().firstChild.children.length).toEqual(4);
- expect(vc.element().firstChild.lastChild.getAttribute('class')).toEqual('operators');
+ expect(vc.element().firstChild.lastChild.getAttribute('class')).toEqual('operators button-group');
// Remove inner group and flatten
_delOn(vc.root().getOperand(2).getOperand(0));
@@ -1453,7 +1453,7 @@
// Operands and operators
expect(vc.element().firstChild.children.length).toEqual(5);
- expect(vc.element().firstChild.lastChild.getAttribute('class')).toEqual('operators');
+ expect(vc.element().firstChild.lastChild.getAttribute('class')).toEqual('operators button-group');
});
});
@@ -1515,7 +1515,7 @@
var fc = vc.element().firstChild;
expect(fc.getAttribute('data-operation')).toEqual('and');
expect(fc.children.length).toEqual(3);
- expect(fc.lastChild.getAttribute('class')).toEqual('operators');
+ expect(fc.lastChild.getAttribute('class')).toEqual('operators button-group');
expect(fc.children[0].getAttribute('class')).toEqual('doc');
expect(fc.children[1].getAttribute('class')).toEqual('doc');
@@ -1526,7 +1526,7 @@
fc = vc.element().firstChild;
expect(fc.getAttribute('data-operation')).toEqual('and');
expect(fc.children.length).toEqual(4);
- expect(fc.lastChild.getAttribute('class')).toEqual('operators');
+ expect(fc.lastChild.getAttribute('class')).toEqual('operators button-group');
expect(fc.children[0].getAttribute('class')).toEqual('doc');
expect(fc.children[1].getAttribute('class')).toEqual('doc unspecified');
@@ -1559,7 +1559,7 @@
var fc = vc.element().firstChild;
expect(fc.children.length).toEqual(3);
- expect(fc.lastChild.getAttribute('class')).toEqual('operators');
+ expect(fc.lastChild.getAttribute('class')).toEqual('operators button-group');
expect(fc.children[0].getAttribute('class')).toEqual('doc');
expect(fc.children[1].getAttribute('class')).toEqual('doc');
@@ -1573,15 +1573,15 @@
expect(fc.children[0].getAttribute('class')).toEqual('docGroup');
expect(fc.children[0].getAttribute('data-operation')).toEqual('or');
expect(fc.children[1].getAttribute('class')).toEqual('doc');
- expect(fc.children[2].getAttribute('class')).toEqual('operators');
- expect(fc.lastChild.getAttribute('class')).toEqual('operators');
+ expect(fc.children[2].getAttribute('class')).toEqual('operators button-group');
+ expect(fc.lastChild.getAttribute('class')).toEqual('operators button-group');
fc = vc.element().firstChild.firstChild;
expect(fc.children.length).toEqual(3);
expect(fc.children[0].getAttribute('class')).toEqual('doc');
expect(fc.children[1].getAttribute('class')).toEqual('doc unspecified');
- expect(fc.children[2].getAttribute('class')).toEqual('operators');
- expect(fc.lastChild.getAttribute('class')).toEqual('operators');
+ expect(fc.children[2].getAttribute('class')).toEqual('operators button-group');
+ expect(fc.lastChild.getAttribute('class')).toEqual('operators button-group');
});
it('should add new unspecified doc with "and" before group', function () {