Skip to content

Commit

Permalink
Updated specs
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed Mar 4, 2021
1 parent 984409e commit 66b51aa
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -40,7 +40,7 @@
"start-server-and-test": "^1.10.6",
"typedoc": "^0.17.7",
"typedoc-plugin-markdown": "^2.2.17",
"typescript": "3.8.3",
"typescript": "^4.2.2",
"web-ext": "^5.0.0"
},
"repository": {
Expand Down
Expand Up @@ -25,6 +25,7 @@ exports[`AddCollectionQueryDialogComponent should render correctly 1`] = `
>
<label>
SAVE_TO_COLLECTION_SELECT_COLLECTION
</label>
</nz-form-label>
<nz-form-control
Expand All @@ -48,7 +49,6 @@ exports[`AddCollectionQueryDialogComponent should render correctly 1`] = `
<nz-select-search
class="ant-select-selection-search"
>
Expand All @@ -62,6 +62,8 @@ exports[`AddCollectionQueryDialogComponent should render correctly 1`] = `
</nz-select-search>
<nz-select-placeholder
class="ant-select-selection-placeholder"
>
Expand All @@ -71,7 +73,6 @@ exports[`AddCollectionQueryDialogComponent should render correctly 1`] = `
</nz-select-placeholder>
</nz-select-top-control>
<nz-select-arrow
class="ant-select-arrow"
>
Expand Down Expand Up @@ -104,6 +105,7 @@ exports[`AddCollectionQueryDialogComponent should render correctly 1`] = `
</nz-select-arrow>
</nz-select>
</div>
<span
Expand Down Expand Up @@ -147,6 +149,7 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [collect
>
<label>
SAVE_TO_COLLECTION_SELECT_COLLECTION
</label>
</nz-form-label>
<nz-form-control
Expand All @@ -170,7 +173,6 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [collect
<nz-select-search
class="ant-select-selection-search"
>
Expand All @@ -184,6 +186,8 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [collect
</nz-select-search>
<nz-select-placeholder
class="ant-select-selection-placeholder"
>
Expand All @@ -193,7 +197,6 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [collect
</nz-select-placeholder>
</nz-select-top-control>
<nz-select-arrow
class="ant-select-arrow"
>
Expand Down Expand Up @@ -226,6 +229,7 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [collect
</nz-select-arrow>
</nz-select>
</div>
<span
Expand Down Expand Up @@ -269,6 +273,7 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [windowT
>
<label>
SAVE_TO_COLLECTION_SELECT_COLLECTION
</label>
</nz-form-label>
<nz-form-control
Expand All @@ -292,7 +297,6 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [windowT
<nz-select-search
class="ant-select-selection-search"
>
Expand All @@ -306,6 +310,8 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [windowT
</nz-select-search>
<nz-select-placeholder
class="ant-select-selection-placeholder"
>
Expand All @@ -315,7 +321,6 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [windowT
</nz-select-placeholder>
</nz-select-top-control>
<nz-select-arrow
class="ant-select-arrow"
>
Expand Down Expand Up @@ -348,6 +353,7 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [windowT
</nz-select-arrow>
</nz-select>
</div>
<span
Expand Down
Expand Up @@ -7,6 +7,7 @@ import { SharedModule } from 'app/modules/shared/shared.module';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { mount } from '../../../testing/utils';
import { NgxTestWrapper } from 'testing/wrapper';
import { DialogComponent } from '../dialog/dialog.component';

describe('AddCollectionQueryDialogComponent', () => {
let wrapper: NgxTestWrapper<AddCollectionQueryDialogComponent>;
Expand Down Expand Up @@ -41,7 +42,7 @@ describe('AddCollectionQueryDialogComponent', () => {
});

it('should set showDialog on app-dialog with [showDialog]', async() => {
const appDialog = wrapper.find('app-dialog');
const appDialog = wrapper.find<DialogComponent>('app-dialog');
wrapper.setProps({ showDialog: true });

expect(appDialog.componentInstance.showDialog).toBe(true);
Expand Down
Expand Up @@ -6,6 +6,8 @@ exports[`DialogComponent should render correctly 1`] = `
</nz-modal>
</app-dialog>
`;
Expand Up @@ -6,6 +6,8 @@ exports[`HistoryDialogComponent should render correctly 1`] = `
</nz-modal>
</app-history-dialog>
`;
Expand Up @@ -2,7 +2,6 @@ import { expect, describe, it } from '@jest/globals';
import { HistoryDialogComponent } from './history-dialog.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { SharedModule } from 'app/modules/shared/shared.module';
import { NzModalComponent } from 'ng-zorro-antd';
import { NgxTestWrapper } from '../../../testing/wrapper';
import { mount } from '../../../testing/utils';
import { MockModule, MockComponent } from 'ng-mocks';
Expand Down
Expand Up @@ -6,6 +6,8 @@ exports[`ImportCurlDialogComponent should render correctly 1`] = `
</nz-modal>
</app-import-curl-dialog>
`;
Expand Up @@ -77,7 +77,7 @@ describe('QueryCollectionsComponent', () => {

await wrapper.nextTick();

const collectionItems = wrapper.findAll('app-query-collection-item');
const collectionItems = wrapper.findAll<QueryCollectionItemComponent>('app-query-collection-item');
expect(collectionItems.length).toBe(3);
expect(collectionItems[0].componentInstance.collection).toEqual({ id: 1, title: 'Collection 1', queries: [] });
expect(collectionItems[1].componentInstance.collection).toEqual({ id: 2, title: 'Collection 2', queries: [] });
Expand Down
Expand Up @@ -7,6 +7,7 @@ exports[`QueryEditorComponent should render correctly 1`] = `
>
<ngx-codemirror
class="query-editor__input"
ngdefaultcontrol=""
/>
</div>
<div
Expand Down
18 changes: 9 additions & 9 deletions packages/altair-app/src/testing/wrapper/index.ts
Expand Up @@ -44,28 +44,28 @@ export class NgxTestWrapper<C extends any> {
return !!this._mainComponentDebugEl;
}

find(selector: string) {
find<SC extends any = unknown>(selector: string) {
const comp = this._mainComponentDebugEl.query(By.css(selector));

return new NgxTestWrapper(this._testHostFixture, comp);
return new NgxTestWrapper<SC>(this._testHostFixture, comp);
}

findComponent(type: Type<any>) {
findComponent<SC extends any = unknown>(type: Type<any>) {
const comp = this._mainComponentDebugEl.query(By.directive(type));

if (comp) {
return new NgxTestWrapper(this._testHostFixture, comp);
return new NgxTestWrapper<SC>(this._testHostFixture, comp);
}
}

findAll(selector: string) {
findAll<SC extends any = unknown>(selector: string) {
return this._mainComponentDebugEl.queryAll(By.css(selector))
.map(comp => new NgxTestWrapper(this._testHostFixture, comp));
.map(comp => new NgxTestWrapper<SC>(this._testHostFixture, comp));
}

findAllComponents(type: Type<any>) {
findAllComponents<SC extends any = unknown>(type: Type<any>) {
return this._mainComponentDebugEl.queryAll(By.directive(type))
.map(comp => new NgxTestWrapper(this._testHostFixture, comp));
.map(comp => new NgxTestWrapper<SC>(this._testHostFixture, comp));
}

emit(eventName: string, eventObj: any = null) {
Expand Down Expand Up @@ -104,7 +104,7 @@ export class NgxTestWrapper<C extends any> {
// For component inputs (@input), we set the data on the test host itself, which would pass the value as input.
// This is to properly trigger the full input lifecycle of the component.
// Setting the input directly on the component instance would not do that.
this._testHostFixture.componentInstance.inputs[prop] = valueObj[prop];
this._testHostFixture.componentInstance.inputs[prop] = (valueObj as any)[prop];
}
});
return setProps(this._testHostFixture, this._mainComponentDebugEl, valueObj);
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -9598,10 +9598,10 @@ typedoc@^0.17.7:
shelljs "^0.8.4"
typedoc-default-themes "^0.10.1"

typescript@3.8.3:
version "3.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==
typescript@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.2.tgz#1450f020618f872db0ea17317d16d8da8ddb8c4c"
integrity sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ==

uglify-js@^3.1.4:
version "3.7.5"
Expand Down

0 comments on commit 66b51aa

Please sign in to comment.