Finished subscriber view
diff --git a/views/ngXosViews/subscribers/karma.conf.js b/views/ngXosViews/subscribers/karma.conf.js
index 4123be9..0e9c4d8 100644
--- a/views/ngXosViews/subscribers/karma.conf.js
+++ b/views/ngXosViews/subscribers/karma.conf.js
@@ -26,6 +26,7 @@
// list of files / patterns to load in the browser
files: bowerComponents.concat([
+ 'node_modules/babel-polyfill/dist/polyfill.js',
'../../../xos/core/xoslib/static/js/vendor/ngXosVendor.js',
'../../../xos/core/xoslib/static/js/vendor/ngXosHelpers.js',
'src/js/**/*.js',
@@ -78,7 +79,10 @@
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
- browsers: ['PhantomJS'],
+ browsers: [
+ 'PhantomJS',
+ 'Chrome'
+ ],
// Continuous Integration mode
diff --git a/views/ngXosViews/subscribers/package.json b/views/ngXosViews/subscribers/package.json
index 3d5def5..96a2326 100644
--- a/views/ngXosViews/subscribers/package.json
+++ b/views/ngXosViews/subscribers/package.json
@@ -21,6 +21,7 @@
"dependencies": {},
"devDependencies": {
"autoprefixer": "^6.3.3",
+ "babel-polyfill": "^6.9.0",
"browser-sync": "^2.9.11",
"css-mqpacker": "^4.0.0",
"csswring": "^4.2.1",
@@ -48,6 +49,7 @@
"jasmine-core": "~2.3.4",
"karma": "^0.13.14",
"karma-babel-preprocessor": "~5.2.2",
+ "karma-chrome-launcher": "^1.0.1",
"karma-coverage": "^0.5.3",
"karma-jasmine": "~0.3.6",
"karma-mocha-reporter": "~1.1.1",
diff --git a/views/ngXosViews/subscribers/spec/sample.test.js b/views/ngXosViews/subscribers/spec/sample.test.js
index 9b06600..1b7796c 100644
--- a/views/ngXosViews/subscribers/spec/sample.test.js
+++ b/views/ngXosViews/subscribers/spec/sample.test.js
@@ -1,7 +1,17 @@
'use strict';
-describe('The User List', () => {
+describe('The Subscriber View', () => {
+ const subscribersList = [
+ {
+ humanReadableName: 'cordSubscriber-1',
+ features: {cdn: false, uplink_speed: 1000000000, downlink_speed: 1000000000, uverse: true, status: 'enabled'},
+ id: 1,
+ identity: {account_num: '123', name: 'Stanford'},
+ related: {}
+ }
+ ];
+
var scope, element, isolatedScope, httpBackend;
beforeEach(module('xos.subscribers'));
@@ -10,28 +20,34 @@
beforeEach(inject(function($httpBackend, $compile, $rootScope){
httpBackend = $httpBackend;
- // Setting up mock request
- $httpBackend.expectGET('/api/core/users/?no_hyperlinks=1').respond([
- {
- email: 'matteo.scandolo@gmail.com',
- firstname: 'Matteo',
- lastname: 'Scandolo'
- }
- ]);
+
+ httpBackend.whenGET('/api/tenant/cord/subscriber/?no_hyperlinks=1').respond(subscribersList);
scope = $rootScope.$new();
- element = angular.element('<users-list></users-list>');
+ element = angular.element('<subscribers-list></subscribers-list>');
$compile(element)(scope);
scope.$digest();
isolatedScope = element.isolateScope().vm;
}));
- xit('should load 1 users', () => {
+ it('should load 1 subscriber', () => {
+ // this
httpBackend.flush();
- expect(isolatedScope.users.length).toBe(1);
- expect(isolatedScope.users[0].email).toEqual('matteo.scandolo@gmail.com');
- expect(isolatedScope.users[0].firstname).toEqual('Matteo');
- expect(isolatedScope.users[0].lastname).toEqual('Scandolo');
+ scope.$digest();
+ let table = $(element).find('table');
+ let tr = table.find('tbody:last-child tr');
+ // let tds = $(tr[1]).find('td');
+ // console.log(tr);
+ expect(tr.length).toBe(1);
+ // expect($(tds[0]).html()).toBe('cordSubscriber-1')
+ });
+
+ it('should configure xos-smart-table', () => {
+ expect(isolatedScope.smartTableConfig).toEqual({resource: 'Subscribers'});
+ });
+
+ it('should render xos-smart-table', () => {
+ expect($(element).find('xos-smart-table').length).toBe(1);
});
});
\ No newline at end of file
diff --git a/views/ngXosViews/subscribers/src/js/main.js b/views/ngXosViews/subscribers/src/js/main.js
index 838efa0..203e9ff 100644
--- a/views/ngXosViews/subscribers/src/js/main.js
+++ b/views/ngXosViews/subscribers/src/js/main.js
@@ -28,27 +28,6 @@
this.smartTableConfig = {
resource: 'Subscribers'
};
-
- this.model = {
- label: {
- name: 'aaa'
- },
- empty: {}
- }
- this.config = {
- exclude: ['password', 'last_login'],
- formName: 'sampleForm',
- actions: [
- {
- label: 'Save',
- icon: 'ok', // refers to bootstraps glyphicon
- cb: (user) => { // receive the model
- console.log(user);
- },
- class: 'success'
- }
- ]
- };
}
};
});
\ No newline at end of file
diff --git a/views/ngXosViews/subscribers/src/templates/subscribers-list.tpl.html b/views/ngXosViews/subscribers/src/templates/subscribers-list.tpl.html
index 2e9298b..d6e755b 100644
--- a/views/ngXosViews/subscribers/src/templates/subscribers-list.tpl.html
+++ b/views/ngXosViews/subscribers/src/templates/subscribers-list.tpl.html
@@ -1,2 +1 @@
-<!-- <xos-form ng-model="vm.model" config="vm.config"></xos-form> -->
<xos-smart-table config="vm.smartTableConfig"></xos-smart-table>
\ No newline at end of file