LP#1472787: add regression test
authorGalen Charlton <gmc@esilibrary.com>
Wed, 8 Jul 2015 22:24:55 +0000 (22:24 +0000)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 17:39:18 +0000 (13:39 -0400)
This patch adds some unit tests for egGrid's egGridColumnsProvider,
including regression tests for LP#1472787.

To run these tests (and all others for the web staff client)
from with a Git checkout of Evergreen:

[1] cd Open-ILS/web/js/ui/default/staff
[2] grunt test

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/web/js/ui/default/staff/test/unit/egGrid.js [new file with mode: 0644]

diff --git a/Open-ILS/web/js/ui/default/staff/test/unit/egGrid.js b/Open-ILS/web/js/ui/default/staff/test/unit/egGrid.js
new file mode 100644 (file)
index 0000000..2128daf
--- /dev/null
@@ -0,0 +1,23 @@
+'use strict';
+
+describe('egGridColumnsProvider', function(){
+    beforeEach(module('egCoreMod'));
+    beforeEach(module('egGridMod'));
+
+    it('expand eg-grid-field wildcard paths', inject(function(egGridColumnsProvider, egIDL) {
+        egIDL.parseIDL();
+        var cols = egGridColumnsProvider.instance({
+           idlClass : "circ" 
+        });
+        cols.expandPath({
+            path : "*"
+        });
+        // the next two are regression tests for LP#1472787
+        expect(cols.indexOf("grace_period")).not.toBe(-1);
+        expect(cols.indexOf(".grace_period")).toBe(-1);
+        cols.expandPath({
+            path : "usr.*"
+        });
+        expect(cols.indexOf("usr.family_name")).not.toBe(-1);
+    }));
+});