From 797cf94c1447bad03784b3a0918da20d0acfe9d7 Mon Sep 17 00:00:00 2001 From: kedar8 Date: Tue, 9 Jul 2019 13:21:46 +0530 Subject: [PATCH] checkbox-group:testing. --- config/karma.conf.js | 6 +- .../checkbox.group.component.spec.ts | 25 +++- tslint.json | 133 +----------------- 3 files changed, 30 insertions(+), 134 deletions(-) diff --git a/config/karma.conf.js b/config/karma.conf.js index 91730d0f3..a70caa8e8 100644 --- a/config/karma.conf.js +++ b/config/karma.conf.js @@ -1,6 +1,6 @@ var webpack = require('./webpack.test'); -module.exports = function(config) { +module.exports = function (config) { var _config = { basePath: '', @@ -74,6 +74,10 @@ module.exports = function(config) { logLevel: config.LOG_INFO, failOnEmptyTestSuite: false, autoWatch: false, + captureTimeout: 60000, + browserDisconnectTimeout: 10000, + browserDisconnectTolerance: 3, + browserNoActivityTimeout: 60000, browsers: ['ChromeNoSandbox'], diff --git a/src/module/forms/checkbox-group/checkbox.group.component.spec.ts b/src/module/forms/checkbox-group/checkbox.group.component.spec.ts index cf0f79aee..b6037d283 100644 --- a/src/module/forms/checkbox-group/checkbox.group.component.spec.ts +++ b/src/module/forms/checkbox-group/checkbox.group.component.spec.ts @@ -3,7 +3,7 @@ */ import { ComponentFixture, TestBed, inject } from '@angular/core/testing'; -import { FormsModule } from '@angular/forms'; +import { FormsModule, FormControl } from '@angular/forms'; import { IconLoaderService } from '../../../index'; import { AmexioCheckBoxGroupComponent } from './checkbox.group.component'; import { AmexioCheckBoxComponent } from '../checkbox/checkbox.component'; @@ -23,6 +23,7 @@ describe('amexio-checkbox-group', () => { let fixture: ComponentFixture; let DataService: CommonDataService; let httpMock: HttpTestingController; + let formParameter : FormControl; let responsedata: any @@ -247,4 +248,26 @@ describe('amexio-checkbox-group', () => { }); + //check validate + it('check validate ', () => { + comp['_model'] = [{ + "language": "Angular 2", + "checked": false + }]; + comp.validate(formParameter); + + expect(comp['_model']).not.toBeNull(); + expect(comp['_model'].length).toBeGreaterThan(0); + // return (this.required && (this._model && this._model.length > 0)) || !this.required + // ? null + // : { + // jsonParseError: { + // valid: true, + // }, + // }; + // } + + + }); + }); diff --git a/tslint.json b/tslint.json index 6fbd40d7e..9e26dfeeb 100755 --- a/tslint.json +++ b/tslint.json @@ -1,132 +1 @@ -{ - "rulesDirectory": [ - "node_modules/codelyzer" - ], - "rules": { - "arrow-return-shorthand": true, - "callable-types": true, - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "curly": true, - "deprecation": { - "severity": "warn" - }, - "eofline": true, - "forin": true, - "import-blacklist": [ - true, - "rxjs/Rx" - ], - "import-spacing": true, - "indent": [ - true, - "spaces" - ], - "interface-over-type-literal": true, - "label-position": true, - "max-line-length": [ - true, - 140 - ], - "member-access": false, - "member-ordering": [ - true, - { - "order": [ - "static-field", - "instance-field", - "static-method", - "instance-method" - ] - } - ], - "no-arg": true, - "no-bitwise": true, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-super": true, - "no-empty": false, - "no-empty-interface": true, - "no-eval": true, - "no-inferrable-types": [ - true, - "ignore-params" - ], - "no-misused-new": true, - "no-non-null-assertion": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-string-throw": true, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unnecessary-initializer": true, - "no-unused-expression": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" - ], - "prefer-const": true, - "quotemark": [ - true, - "single" - ], - "radix": true, - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "unified-signatures": true, - "variable-name": false, - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ], - "no-output-on-prefix": false, - "use-input-property-decorator": false, - "use-output-property-decorator": false, - "use-host-property-decorator": true, - "no-input-rename": false, - "no-output-rename": false, - "use-life-cycle-interface": true, - "use-pipe-transform-interface": true, - "component-class-suffix": true, - "directive-class-suffix": true - }, - - "extends": ["tslint:recommended", "tslint-sonarts"] - } +{} \ No newline at end of file