Fixed code formatting
diff --git a/views/ngXosLib/package.json b/views/ngXosLib/package.json
index da9d27b..ba25551 100644
--- a/views/ngXosLib/package.json
+++ b/views/ngXosLib/package.json
@@ -12,7 +12,8 @@
"doc": "gulp docs; cd ./docs",
"doc:ci": "gulp makeDocs;",
"build": "gulp vendor && gulp helpers",
- "dev": "gulp dev"
+ "dev": "gulp dev",
+ "lint": "eslint xosHelpers/"
},
"author": "Matteo Scandolo",
"license": "ISC",
diff --git a/views/ngXosLib/xosHelpers/spec/services/helpers/form.helpers.test.js b/views/ngXosLib/xosHelpers/spec/services/helpers/form.helpers.test.js
index 29d812d..21e2649 100644
--- a/views/ngXosLib/xosHelpers/spec/services/helpers/form.helpers.test.js
+++ b/views/ngXosLib/xosHelpers/spec/services/helpers/form.helpers.test.js
@@ -186,11 +186,13 @@
type: 'number',
hint: 'Test Hint'
},
- select:{
+ select: {
label: 'Select Label',
type: 'select',
hint: 'Select Hint',
- options:{}
+ options: [
+ {id: 1, label: 'something'}
+ ]
}
};
@@ -231,12 +233,14 @@
validators: {},
hint: 'Test Hint'
},
- select:{
+ select: {
label: 'Select Label:',
type: 'select',
hint: 'Select Hint',
validators: {},
- options:{}
+ options: [
+ {id: 1, label: 'something'}
+ ]
}
};
diff --git a/views/ngXosLib/xosHelpers/spec/ui/field.test.js b/views/ngXosLib/xosHelpers/spec/ui/field.test.js
index e985cd6..b946f93 100644
--- a/views/ngXosLib/xosHelpers/spec/ui/field.test.js
+++ b/views/ngXosLib/xosHelpers/spec/ui/field.test.js
@@ -103,13 +103,16 @@
label: 'Label',
type: 'select',
validators: {},
- options:[{
- id:0,
- label:"---Site---"
- },{
- id:1,
- label:"---Site1---"
- }]
+ options: [
+ {
+ id: 0,
+ label: '---Site---'
+ },
+ {
+ id: 1,
+ label: '---Site1---'
+ }
+ ]
};
scope.ngModel = 'label';
compileElement();
diff --git a/views/ngXosLib/xosHelpers/spec/ui/form.test.js b/views/ngXosLib/xosHelpers/spec/ui/form.test.js
index cb9f9e8..eac10f5 100644
--- a/views/ngXosLib/xosHelpers/spec/ui/form.test.js
+++ b/views/ngXosLib/xosHelpers/spec/ui/form.test.js
@@ -33,21 +33,21 @@
compile = $compile;
}));
- it('should throw an error if no config is specified', inject(($compile, $rootScope) => {
+ it('should throw an error if no config is specified', () => {
function errorFunctionWrapper(){
compileElement();
}
expect(errorFunctionWrapper).toThrow(new Error('[xosForm] Please provide a configuration via the "config" attribute'));
- }));
+ });
- it('should throw an error if no actions is specified', inject(($compile, $rootScope) => {
+ it('should throw an error if no actions is specified', () => {
function errorFunctionWrapper(){
- scope = $rootScope.$new();
+ scope = rootScope.$new();
scope.config = 'green';
compileElement();
}
expect(errorFunctionWrapper).toThrow(new Error('[xosForm] Please provide an action list in the configuration'));
- }));
+ });
describe('when correctly configured', () => {
diff --git a/views/ngXosLib/xosHelpers/spec/ui/table.test.js b/views/ngXosLib/xosHelpers/spec/ui/table.test.js
index e94eb36..1535c6e 100644
--- a/views/ngXosLib/xosHelpers/spec/ui/table.test.js
+++ b/views/ngXosLib/xosHelpers/spec/ui/table.test.js
@@ -31,22 +31,22 @@
rootScope = $rootScope;
}));
- it('should throw an error if no config is specified', inject(($compile, $rootScope) => {
+ it('should throw an error if no config is specified', () => {
function errorFunctionWrapper(){
compileElement();
}
expect(errorFunctionWrapper).toThrow(new Error('[xosTable] Please provide a configuration via the "config" attribute'));
- }));
+ });
- it('should throw an error if no config columns are specified', inject(($compile, $rootScope) => {
+ it('should throw an error if no config columns are specified', () => {
function errorFunctionWrapper(){
// setup the parent scope
- scope = $rootScope.$new();
+ scope = rootScope.$new();
scope.config = 'green';
compileElement();
}
expect(errorFunctionWrapper).toThrow(new Error('[xosTable] Please provide a columns list in the configuration'));
- }));
+ });
describe('when basicly configured', function() {
diff --git a/views/ngXosLib/xosHelpers/spec/ui/validation.test.js b/views/ngXosLib/xosHelpers/spec/ui/validation.test.js
index bb663fa..f8350ed 100644
--- a/views/ngXosLib/xosHelpers/spec/ui/validation.test.js
+++ b/views/ngXosLib/xosHelpers/spec/ui/validation.test.js
@@ -7,7 +7,7 @@
(function () {
'use strict';
- let compile, element, scope, isolatedScope;
+ let compile, element, scope;
const compileElement = (el) => {
element = el;
@@ -20,7 +20,6 @@
}
compile(element)(scope);
scope.$digest();
- isolatedScope = element.isolateScope().vm;
}
describe('The xos.helper module', function(){
diff --git a/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartPie/smartPie.component.js b/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartPie/smartPie.component.js
index c1f08fa..f8a3985 100644
--- a/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartPie/smartPie.component.js
+++ b/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartPie/smartPie.component.js
@@ -198,13 +198,11 @@
const formatLabels = (data) => angular.isFunction(this.config.labelFormatter) ? this.config.labelFormatter(Object.keys(data)) : Object.keys(data);
const prepareData = (data) => {
- // $timeout(() => {
- // group data
- let grouped = groupData(data);
- this.data = formatData(grouped);
- // create labels
- this.labels = formatLabels(grouped);
- // }, 10);
+ // group data
+ let grouped = groupData(data);
+ this.data = formatData(grouped);
+ // create labels
+ this.labels = formatLabels(grouped);
}
if(this.config.resource){
diff --git a/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js b/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js
index b3a2eec..27b1ef6 100644
--- a/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js
+++ b/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js
@@ -225,7 +225,7 @@
let props = Object.keys(item);
_.remove(props, p => {
- return p == 'id' || p == 'validators'
+ return p === 'id' || p === 'validators'
});
// TODO move out cb, non sense triggering a lot of times