Skip to content

Commit 15cc62a

Browse files
authored
Merge pull request #222 from tbelcheva/fix-issue-187
Fix for issues #187 and #146
2 parents 97ec9c4 + a1fab52 commit 15cc62a

File tree

13 files changed

+435
-285
lines changed

13 files changed

+435
-285
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ build/Release
2525

2626
# Dependency directory
2727
node_modules
28+
bower_components
2829

2930
# Optional npm cache directory
3031
.npm

package.json

Lines changed: 72 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,72 @@
1-
{
2-
"name": "igniteui-angular2",
3-
"version": "1.0.0",
4-
"license": "MIT",
5-
"repository": {
6-
"type": "git",
7-
"url": "https://github.com/IgniteUI/igniteui-angular2.git"
8-
},
9-
"dependencies": {
10-
"@angular/common": "^5.0.1",
11-
"@angular/compiler": "^5.0.1",
12-
"@angular/core": "^5.0.1",
13-
"@angular/http": "^5.0.1",
14-
"@angular/forms": "^5.0.1",
15-
"@angular/platform-browser": "^5.0.1",
16-
"@angular/platform-browser-dynamic": "^5.0.1",
17-
"@angular/router": "^5.0.1",
18-
"@angular/upgrade": "^5.0.1",
19-
"angular-in-memory-web-api": "~0.3.0",
20-
21-
"core-js": "^2.4.1",
22-
"systemjs": "0.19.40",
23-
"es6-shim": "^0.35.0",
24-
"reflect-metadata": "^0.1.3",
25-
"rxjs": "^5.5.0",
26-
"zone.js": "^0.8.4",
27-
28-
"bootstrap": "^3.3.6"
29-
},
30-
"devDependencies": {
31-
"@angular/compiler-cli": "^5.0.1",
32-
"concurrently": "^3.2.0",
33-
"gulp-watch": "^4.3.5",
34-
"jasmine-core": "^2.4.1",
35-
"karma": "^0.13.19",
36-
"karma-chrome-launcher": "^0.2.2",
37-
"karma-jasmine": "^0.2.2",
38-
"karma-junit-reporter": "^0.4.2",
39-
"karma-coverage": "",
40-
"karma-remap-istanbul": "0.5.0",
41-
"lite-server": "^2.2.2",
42-
"typescript": "^2.6.1",
43-
"coveralls": "^2.11.9",
44-
"traceur": "^0.0.111",
45-
"@types/node": "^6.0.46",
46-
"@types/jasmine": "^2.5.36",
47-
"@types/reflect-metadata": "^0.0.5",
48-
"@types/ignite-ui": "^0.0.4",
49-
"@types/jquery": "2.0.47",
50-
"rollup": "^0.52.1",
51-
"rollup-plugin-node-resolve": "^3.0.0",
52-
"rollup-plugin-commonjs": "^8.2.6",
53-
"rollup-plugin-angular": "^0.5.3",
54-
"rollup-plugin-typescript": "^0.8.1"
55-
},
56-
"scripts": {
57-
"postinstall": "npm prune",
58-
59-
"start": "npm run lite",
60-
"lite": "lite-server",
61-
62-
"watch": "node node_modules/typescript/bin/tsc -w",
63-
"build": "node node_modules/typescript/bin/tsc -p tsconfig.json",
64-
"build-aot": "ngc -p tsconfig-aot.json",
65-
"build-aot-samples": "ngc -p tsconfig-aot-samples.json",
66-
"bundle": "npm run build-aot && npm run prepare-dist",
67-
"prepare-dist": "rollup -c rollup.config.umd.js",
68-
69-
"pretest": "npm run bundle && npm run build",
70-
"test": "karma start tests/karma.conf.js && npm run remap-istanbul",
71-
72-
"remap-istanbul": "npm run copy-coverage-report && npm run remap-istanbul-html && npm run remap-istanbul-lcov",
73-
"remap-istanbul-html": "remap-istanbul -i coverage/karma-tmp/coverage.json -o coverage/html-report -t html",
74-
"remap-istanbul-lcov": "remap-istanbul -i coverage/karma-tmp/coverage.json -o coverage/lcov.info -t lcovonly",
75-
"copy-coverage-report": "cp coverage/karma-tmp/**/coverage*.json coverage/karma-tmp/"
76-
}
77-
}
1+
{
2+
"name": "igniteui-angular2",
3+
"version": "1.0.0",
4+
"license": "MIT",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/IgniteUI/igniteui-angular2.git"
8+
},
9+
"dependencies": {
10+
"@angular/common": "^5.0.1",
11+
"@angular/compiler": "^5.0.1",
12+
"@angular/core": "^5.0.1",
13+
"@angular/http": "^5.0.1",
14+
"@angular/forms": "^5.0.1",
15+
"@angular/platform-browser": "^5.0.1",
16+
"@angular/platform-browser-dynamic": "^5.0.1",
17+
"@angular/router": "^5.0.1",
18+
"@angular/upgrade": "^5.0.1",
19+
"angular-in-memory-web-api": "~0.3.0",
20+
"core-js": "^2.4.1",
21+
"systemjs": "0.19.40",
22+
"es6-shim": "^0.35.0",
23+
"reflect-metadata": "^0.1.3",
24+
"rxjs": "^5.5.0",
25+
"zone.js": "^0.8.4",
26+
"bootstrap": "^3.3.6"
27+
},
28+
"devDependencies": {
29+
"jquery-mockjax": "2.2.2",
30+
"@angular/compiler-cli": "^5.0.1",
31+
"concurrently": "^3.2.0",
32+
"gulp-watch": "^4.3.5",
33+
"jasmine-core": "^2.4.1",
34+
"karma": "^0.13.19",
35+
"karma-chrome-launcher": "^0.2.2",
36+
"karma-jasmine": "^0.2.2",
37+
"karma-junit-reporter": "^0.4.2",
38+
"karma-coverage": "",
39+
"karma-remap-istanbul": "0.5.0",
40+
"lite-server": "^2.2.2",
41+
"typescript": "^2.6.1",
42+
"coveralls": "^2.11.9",
43+
"traceur": "^0.0.111",
44+
"@types/node": "^6.0.46",
45+
"@types/jasmine": "^2.5.36",
46+
"@types/reflect-metadata": "^0.0.5",
47+
"@types/ignite-ui": "^0.0.4",
48+
"@types/jquery": "2.0.47",
49+
"rollup": "^0.52.1",
50+
"rollup-plugin-node-resolve": "^3.0.0",
51+
"rollup-plugin-commonjs": "^8.2.6",
52+
"rollup-plugin-angular": "^0.5.3",
53+
"rollup-plugin-typescript": "^0.8.1"
54+
},
55+
"scripts": {
56+
"postinstall": "npm prune",
57+
"start": "npm run lite",
58+
"lite": "lite-server",
59+
"watch": "node node_modules/typescript/bin/tsc -w",
60+
"build": "node node_modules/typescript/bin/tsc -p tsconfig.json",
61+
"build-aot": "ngc -p tsconfig-aot.json",
62+
"build-aot-samples": "ngc -p tsconfig-aot-samples.json",
63+
"bundle": "npm run build-aot && npm run prepare-dist",
64+
"prepare-dist": "rollup -c rollup.config.umd.js",
65+
"pretest": "npm run bundle && npm run build",
66+
"test": "karma start tests/karma.conf.js && npm run remap-istanbul",
67+
"remap-istanbul": "npm run copy-coverage-report && npm run remap-istanbul-html && npm run remap-istanbul-lcov",
68+
"remap-istanbul-html": "remap-istanbul -i coverage/karma-tmp/coverage.json -o coverage/html-report -t html",
69+
"remap-istanbul-lcov": "remap-istanbul -i coverage/karma-tmp/coverage.json -o coverage/lcov.info -t lcovonly",
70+
"copy-coverage-report": "cp coverage/karma-tmp/**/coverage*.json coverage/karma-tmp/"
71+
}
72+
}

src/igcombo/igcombo.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ export class IgComboComponent extends IgControlBase<IgCombo> implements ControlV
7676
var i, j, valKey = this._config.valueKey, record, item;
7777

7878
//check for changes in collection
79+
if (!(this._config.dataSource instanceof Array)) {
80+
return;
81+
}
7982
this._changes = this._differ.diff(this._config.dataSource);
8083
if (this._config.dataSource && this._config.dataSource.length !== this._dataSource.length) {
8184
this._dataSource = jQuery.extend(true, [], this._config.dataSource);

src/iggrid/iggridbase.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ export class IgGridBase<Model> extends IgControlBase<Model> implements AfterCont
8989
grid = element.data(this._widgetName),
9090
td, i, j, pkKey = this._config.primaryKey, newFormattedVal, record, column;
9191

92-
if (typeof this._config.dataSource === "string") {
92+
//check for changes in collection
93+
if (!(this._config.dataSource instanceof Array)) {
9394
return;
9495
}
95-
//check for changes in collection
9696
this._changes = this._differ.diff(this._config.dataSource);
9797
if (this._changes && grid) {
9898
this._dataSource = jQuery.extend(true, [], this._config.dataSource);

src/ighierarchicalgrid/ighierarchicalgrid.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export class IgHierarchicalGridComponent extends IgGridBase<IgHierarchicalGrid>
3636
data = this._config.dataSource;
3737

3838
//check for changes in collection
39+
if (!(this._config.dataSource instanceof Array)) {
40+
return;
41+
}
3942
this._changes = this._differ.diff(this._config.dataSource);
4043
if (this._changes && mainGrid) {
4144
this._dataSource = jQuery.extend(true, [], this._config.dataSource);

src/igtree/igtree.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export class IgTreeComponent extends IgControlBase<IgTree> {
2727
var i, j, valKey = this._config.valueKey, record, item;
2828

2929
//check for changes in collection
30+
if (!(this._config.dataSource instanceof Array)) {
31+
return;
32+
}
3033
this._changes = this._differ.diff(this._config.dataSource);
3134
if (this._config.dataSource.length !== this._dataSource.length) {
3235
this._dataSource = jQuery.extend(true, [], this._config.dataSource);

src/igtreegrid/igtreegrid.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export class IgTreeGridComponent extends IgGridBase<IgTreeGrid> {
3838
colIndex, td, i, j, pkKey = this._config.primaryKey, newFormattedVal, record, column;
3939

4040
//check for changes in collection
41+
if (!(this._config.dataSource instanceof Array)) {
42+
return;
43+
}
4144
this._changes = this._differ.diff(this._config.dataSource);
4245
if (this._changes && grid) {
4346
this._dataSource = jQuery.extend(true, [], this._config.dataSource);

tests/karma.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = function(config){
1212
'http://cdn-na.infragistics.com/igniteui/latest/js/infragistics.lob.js',
1313
'http://cdn-na.infragistics.com/igniteui/latest/js/infragistics.dv.js',
1414
'https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.js',
15+
'node_modules/jquery-mockjax/dist/jquery.mockjax.js',
1516

1617

1718
{ pattern: 'node_modules/traceur/bin/traceur.js', included: true, watched: false },
@@ -58,7 +59,7 @@ module.exports = function(config){
5859
{ pattern: 'tests/unit/**/*.js', included: false, watched: false },
5960
{ pattern: 'tests/unit/**/*.js.map', included: false, watched: false }
6061
],
61-
62+
6263
// list of files to exclude
6364
exclude: [
6465
'node_modules/**/*spec.js'

tests/unit/igcombo/combo.spec.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,28 @@ export function main() {
179179
}, 10);
180180
});
181181
});
182+
183+
it('should initialize correctly when datasource is remote', (done) => {
184+
$['mockjax']({
185+
url: "myURL/Northwind",
186+
contentType: 'application/json',
187+
dataType: 'json',
188+
responseText: '[{"ProductID": 1, "ProductName": "Chai"}]'
189+
});
190+
var template = '<div><ig-combo [(widgetId)]="comboID" [(options)]="options2" [changeDetectionInterval]="cdi" [(ngModel)]="combo.value1"></ig-combo></div>';
191+
TestBed.overrideComponent(TestComponent, {
192+
set: {
193+
template: template
194+
}
195+
});
196+
TestBed.compileComponents().then(() => {
197+
let fixture = TestBed.createComponent(TestComponent);
198+
fixture.detectChanges();
199+
expect(fixture.debugElement.componentInstance.viewChild instanceof Infragistics.IgComboComponent)
200+
.toBe(true);
201+
done();
202+
});
203+
});
182204
});
183205
}
184206

@@ -188,6 +210,7 @@ export function main() {
188210
})
189211
class TestComponent {
190212
private options: IgCombo;
213+
private options2: IgCombo;
191214
private optionsMultipleSelection: IgCombo;
192215
public northwind: any;
193216
public combo: any;
@@ -206,6 +229,12 @@ class TestComponent {
206229
width: "100%"
207230
};
208231

232+
this.options2 = {
233+
valueKey: "ProductID",
234+
textKey: "ProductName",
235+
dataSource: "myURL/Northwind",
236+
width: "100%"
237+
}
209238
this.optionsMultipleSelection = $.extend({
210239
multiSelection: {
211240
enabled: true,

0 commit comments

Comments
 (0)