Fix VC fragments for redundant constraints
Change-Id: Iff83540e11fd6e3bcb8dba3b789eea9fc7dcb344
diff --git a/dev/js/spec/vcSpec.js b/dev/js/spec/vcSpec.js
index 5c1fdfd..ce8f48f 100644
--- a/dev/js/spec/vcSpec.js
+++ b/dev/js/spec/vcSpec.js
@@ -3129,5 +3129,23 @@
expect(f.element().lastChild.children.length).toEqual(0);
});
+
+ it('should respect already set attributes', function () {
+ var f = fragmentClass.create();
+ expect(f.element().lastChild.children.length).toEqual(0);
+
+ expect(f.isEmpty()).toBeTruthy();
+
+ f.add("author", "Peter");
+ f.add("title", "Example");
+
+ expect(f.isEmpty()).toBeFalsy();
+
+ expect(f.toQuery()).toEqual('author = "Peter" & title = "Example"');
+
+ f.add("author", "Peter");
+
+ expect(f.toQuery()).toEqual('title = "Example" & author = "Peter"');
+ });
});
});