Add pagination info service
Change-Id: I462f05581256575e9b52f474515cb8cb5e533d3b
diff --git a/dev/js/spec/pageInfoSpec.js b/dev/js/spec/pageInfoSpec.js
new file mode 100644
index 0000000..4082bb4
--- /dev/null
+++ b/dev/js/spec/pageInfoSpec.js
@@ -0,0 +1,31 @@
+define(['pageInfo'], function (pageInfoClass) {
+
+ describe('KorAP.PageInfo', function () {
+ it('should be initializable', function () {
+ let pi = pageInfoClass.create();
+ expect(pi.total()).toEqual(0);
+ expect(pi.count()).toEqual(0);
+ expect(pi.page()).toEqual(0);
+ });
+
+ it('should be read the correct values', function () {
+
+ // Create pagination element for pagination information
+ let p = document.createElement('div');
+ p.setAttribute('id', 'pagination')
+ p.setAttribute('data-page',3);
+ p.setAttribute('data-total',30);
+ p.setAttribute('data-count',25);
+
+ document.body.appendChild(p);
+
+ pi = pageInfoClass.create();
+ expect(pi.total()).toEqual(30);
+ expect(pi.count()).toEqual(25);
+ expect(pi.page()).toEqual(3);
+
+ // Recreate initial state
+ document.body.removeChild(p);
+ });
+ });
+});