Skip to content
This repository was archived by the owner on Mar 16, 2021. It is now read-only.

Commit 8a3f6c6

Browse files
committed
Merge branch 'release/5.0.0'
2 parents 3f2723c + b16841f commit 8a3f6c6

18 files changed

Lines changed: 1132 additions & 5329 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/dist
55
/tmp
66
/out-tsc
7+
/projects/hot-table/package.json
78

89
# dependencies
910
/node_modules

.release.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

package-lock.json

Lines changed: 782 additions & 637 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@handsontable/angular",
3-
"version": "4.0.0",
3+
"version": "5.0.0",
44
"description": "Best Data Grid for Angular with Spreadsheet Look and Feel.",
55
"author": "Handsoncode <hello@handsoncode.net> (https://handsoncode.net)",
66
"license": "MIT",
@@ -40,12 +40,14 @@
4040
"ng": "ng",
4141
"start": "ng serve",
4242
"clean": "rimraf dist",
43+
"prebuild": "npm run clean && node scripts/pre-build.js",
4344
"build": "ng build hot-table",
44-
"test": "npm run clean && npm run lint && npm run build && ng test hot-table",
45+
"postbuild": "node scripts/post-build.js",
46+
"pretest": "npm run lint && npm run build",
47+
"test": "ng test hot-table",
4548
"lint": "ng lint hot-table",
4649
"e2e": "ng e2e",
47-
"pre-release": "node scripts/copy-utils.js && node scripts/pre-release.js",
48-
"release": "npm run test && npm run pre-release && npm publish dist/hot-table --access public"
50+
"release": "npm run test && npm publish dist/hot-table --access public"
4951
},
5052
"peerDependencies": {
5153
"handsontable": "^7.0.0",
@@ -73,7 +75,7 @@
7375
"@angular/language-service": "~7.2.6",
7476
"@types/jasmine": "~3.3.9",
7577
"@types/jasminewd2": "~2.0.3",
76-
"@types/node": "~11.9.5",
78+
"@types/node": "^11.9.6",
7779
"codelyzer": "~4.5.0",
7880
"jasmine-core": "~3.3.0",
7981
"jasmine-spec-reporter": "~4.2.1",

projects/hot-table/ng-package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
33
"dest": "../../dist/hot-table",
4+
"deleteDestPath": false,
45
"lib": {
56
"entryFile": "src/public_api.ts",
67
"umdModuleIds": {

projects/hot-table/package.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

projects/hot-table/src/lib/hot-column.component.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { Component } from '@angular/core';
2-
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
3-
2+
import { ComponentFixture, TestBed } from '@angular/core/testing';
43
import { HotTableModule, HotTableRegisterer } from '@handsontable/angular';
5-
import Handsontable from 'handsontable';
64

75
@Component({
86
selector: 'hot-test-component',

projects/hot-table/src/lib/hot-settings-resolver.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class HotSettingsResolver {
2929
} else if (typeof option === 'function' && isHook) {
3030
mergedSettings[key] = function(...args) {
3131
return component._ngZone.run(() => {
32-
return option(this, ...args);
32+
return option.apply(this, args);
3333
});
3434
};
3535

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
import { Component } from '@angular/core';
3+
import { ComponentFixture, TestBed } from '@angular/core/testing';
4+
import Handsontable from 'handsontable';
5+
import { HotTableModule, HotTableRegisterer } from '@handsontable/angular';
6+
7+
@Component({
8+
selector: 'hot-test-component',
9+
template: ''
10+
})
11+
class TestComponent {
12+
public prop: object = {};
13+
id = 'hot';
14+
15+
constructor (private _registerer: HotTableRegisterer) { }
16+
17+
getHotInstance(instance: string): Handsontable {
18+
return this._registerer.getInstance(instance);
19+
}
20+
}
21+
22+
describe('HotTableComponent', () => {
23+
let fixture: ComponentFixture<TestComponent>;
24+
25+
beforeEach((() => {
26+
TestBed.configureTestingModule({
27+
declarations: [ TestComponent ],
28+
imports: [ HotTableModule.forRoot() ],
29+
});
30+
}));
31+
32+
afterEach(() => {
33+
TestBed.resetTestingModule();
34+
});
35+
36+
it(`should register instance if component has hotId attribute`, async() => {
37+
TestBed.overrideComponent(TestComponent, {
38+
set: {
39+
template: `<hot-table [hotId]="id"></hot-table>`
40+
}
41+
});
42+
await TestBed.compileComponents().then(() => {
43+
fixture = TestBed.createComponent(TestComponent);
44+
const app = fixture.componentInstance;
45+
46+
fixture.detectChanges();
47+
48+
expect(app.getHotInstance(app.id)).toBeTruthy();
49+
});
50+
});
51+
52+
it(`should register every hot-table component with added hotID attribute`, async() => {
53+
TestBed.overrideComponent(TestComponent, {
54+
set: {
55+
template: `
56+
<hot-table [hotId]="prop.hotTableId"></hot-table>
57+
<hot-table [hotId]="'hot1'"></hot-table>
58+
<hot-table hotId="hot2"></hot-table>
59+
`
60+
}
61+
});
62+
await TestBed.compileComponents().then(() => {
63+
fixture = TestBed.createComponent(TestComponent);
64+
const app = fixture.componentInstance;
65+
66+
app.prop['hotTableId'] = 'hot';
67+
68+
fixture.detectChanges();
69+
70+
expect(app.getHotInstance(app.prop['hotTableId'])).toBeDefined();
71+
expect(app.getHotInstance('hot1')).toBeDefined();
72+
expect(app.getHotInstance('hot2')).toBeDefined();
73+
});
74+
});
75+
});

0 commit comments

Comments
 (0)