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

Commit

Permalink
Merge branch 'release/5.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpiotr-dev committed May 22, 2019
2 parents 3f2723c + b16841f commit 8a3f6c6
Show file tree
Hide file tree
Showing 18 changed files with 1,132 additions and 5,329 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/dist
/tmp
/out-tsc
/projects/hot-table/package.json

# dependencies
/node_modules
Expand Down
18 changes: 0 additions & 18 deletions .release.json

This file was deleted.

1,419 changes: 782 additions & 637 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@handsontable/angular",
"version": "4.0.0",
"version": "5.0.0",
"description": "Best Data Grid for Angular with Spreadsheet Look and Feel.",
"author": "Handsoncode <hello@handsoncode.net> (https://handsoncode.net)",
"license": "MIT",
Expand Down Expand Up @@ -40,12 +40,14 @@
"ng": "ng",
"start": "ng serve",
"clean": "rimraf dist",
"prebuild": "npm run clean && node scripts/pre-build.js",
"build": "ng build hot-table",
"test": "npm run clean && npm run lint && npm run build && ng test hot-table",
"postbuild": "node scripts/post-build.js",
"pretest": "npm run lint && npm run build",
"test": "ng test hot-table",
"lint": "ng lint hot-table",
"e2e": "ng e2e",
"pre-release": "node scripts/copy-utils.js && node scripts/pre-release.js",
"release": "npm run test && npm run pre-release && npm publish dist/hot-table --access public"
"release": "npm run test && npm publish dist/hot-table --access public"
},
"peerDependencies": {
"handsontable": "^7.0.0",
Expand Down Expand Up @@ -73,7 +75,7 @@
"@angular/language-service": "~7.2.6",
"@types/jasmine": "~3.3.9",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~11.9.5",
"@types/node": "^11.9.6",
"codelyzer": "~4.5.0",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "~4.2.1",
Expand Down
1 change: 1 addition & 0 deletions projects/hot-table/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/hot-table",
"deleteDestPath": false,
"lib": {
"entryFile": "src/public_api.ts",
"umdModuleIds": {
Expand Down
3 changes: 0 additions & 3 deletions projects/hot-table/package.json

This file was deleted.

4 changes: 1 addition & 3 deletions projects/hot-table/src/lib/hot-column.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Component } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HotTableModule, HotTableRegisterer } from '@handsontable/angular';
import Handsontable from 'handsontable';

@Component({
selector: 'hot-test-component',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class HotSettingsResolver {
} else if (typeof option === 'function' && isHook) {
mergedSettings[key] = function(...args) {
return component._ngZone.run(() => {
return option(this, ...args);
return option.apply(this, args);
});
};

Expand Down
75 changes: 75 additions & 0 deletions projects/hot-table/src/lib/hot-table-registerer.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

import { Component } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import Handsontable from 'handsontable';
import { HotTableModule, HotTableRegisterer } from '@handsontable/angular';

@Component({
selector: 'hot-test-component',
template: ''
})
class TestComponent {
public prop: object = {};
id = 'hot';

constructor (private _registerer: HotTableRegisterer) { }

getHotInstance(instance: string): Handsontable {
return this._registerer.getInstance(instance);
}
}

describe('HotTableComponent', () => {
let fixture: ComponentFixture<TestComponent>;

beforeEach((() => {
TestBed.configureTestingModule({
declarations: [ TestComponent ],
imports: [ HotTableModule.forRoot() ],
});
}));

afterEach(() => {
TestBed.resetTestingModule();
});

it(`should register instance if component has hotId attribute`, async() => {
TestBed.overrideComponent(TestComponent, {
set: {
template: `<hot-table [hotId]="id"></hot-table>`
}
});
await TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(TestComponent);
const app = fixture.componentInstance;

fixture.detectChanges();

expect(app.getHotInstance(app.id)).toBeTruthy();
});
});

it(`should register every hot-table component with added hotID attribute`, async() => {
TestBed.overrideComponent(TestComponent, {
set: {
template: `
<hot-table [hotId]="prop.hotTableId"></hot-table>
<hot-table [hotId]="'hot1'"></hot-table>
<hot-table hotId="hot2"></hot-table>
`
}
});
await TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(TestComponent);
const app = fixture.componentInstance;

app.prop['hotTableId'] = 'hot';

fixture.detectChanges();

expect(app.getHotInstance(app.prop['hotTableId'])).toBeDefined();
expect(app.getHotInstance('hot1')).toBeDefined();
expect(app.getHotInstance('hot2')).toBeDefined();
});
});
});
Loading

0 comments on commit 8a3f6c6

Please sign in to comment.