-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SAI): display Timed Actionlists of creatures (#472)
* feat(SAI): display Timed Actionlists of creatures * chore: wip * test: add checks
- Loading branch information
1 parent
f853ef7
commit a9172ad
Showing
4 changed files
with
97 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 17 additions & 1 deletion
18
src/app/shared/modules/sai-editor/timed-actionlist/timed-actionlist.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
|
||
<ngx-datatable | ||
class="bootstrap table table-striped text-center" | ||
[rows]="timedActionlists$ | async" | ||
[headerHeight]="DTCFG.headerHeight" | ||
[footerHeight]="DTCFG.footerHeight" | ||
[columnMode]="DTCFG.columnMode" | ||
[rowHeight]="DTCFG.rowHeight" | ||
> | ||
<ngx-datatable-column [minWidth]="100" [maxWidth]="100" name="entryorguid" prop="entryorguid"></ngx-datatable-column> | ||
<ngx-datatable-column [minWidth]="50" [maxWidth]="60" name="id" prop="id"></ngx-datatable-column> | ||
<ngx-datatable-column [minWidth]="50" [maxWidth]="70" name="action" prop="action_type"></ngx-datatable-column> | ||
<ngx-datatable-column [minWidth]="50" [maxWidth]="70" name="target" prop="target_type"></ngx-datatable-column> | ||
<ngx-datatable-column [minWidth]="50" [maxWidth]="70" name="link" prop="link"></ngx-datatable-column> | ||
<ngx-datatable-column [minWidth]="50" [maxWidth]="70" name="phase" prop="event_phase_mask"></ngx-datatable-column> | ||
<ngx-datatable-column [minWidth]="50" [maxWidth]="70" name="chance" prop="event_chance"></ngx-datatable-column> | ||
<ngx-datatable-column name="comment" prop="comment"></ngx-datatable-column> | ||
</ngx-datatable> |
54 changes: 44 additions & 10 deletions
54
src/app/shared/modules/sai-editor/timed-actionlist/timed-actionlist.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,59 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { async, TestBed } from '@angular/core/testing'; | ||
|
||
import { TimedActionlistComponent } from './timed-actionlist.component'; | ||
import { PageObject } from '@keira-testing/page-object'; | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { MysqlQueryService } from '@keira-shared/services/mysql-query.service'; | ||
import { SmartScripts } from '@keira-types/smart-scripts.type'; | ||
import { of } from 'rxjs'; | ||
import { NgxDatatableModule } from '@swimlane/ngx-datatable'; | ||
|
||
@Component({ | ||
template: `<keira-timed-actionlist [creatureId]="creatureId"></keira-timed-actionlist>` | ||
}) | ||
class TestHostComponent { | ||
@ViewChild(TimedActionlistComponent) child: TimedActionlistComponent; | ||
creatureId: string; | ||
} | ||
|
||
class TimedActionlistPage extends PageObject<TestHostComponent> {} | ||
|
||
describe('TimedActionlistComponent', () => { | ||
let component: TimedActionlistComponent; | ||
let fixture: ComponentFixture<TimedActionlistComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ TimedActionlistComponent ] | ||
declarations: [TimedActionlistComponent, TestHostComponent], | ||
imports: [NgxDatatableModule], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TimedActionlistComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
const setup = () => { | ||
const fixture = TestBed.createComponent(TestHostComponent); | ||
const host = fixture.componentInstance; | ||
const page = new TimedActionlistPage(fixture); | ||
const queryService = TestBed.inject(MysqlQueryService); | ||
page.detectChanges(); | ||
return { page, host, queryService }; | ||
}; | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
const { page, queryService, host } = setup(); | ||
const id = '1234'; | ||
const timedActionlists: SmartScripts[] = [new SmartScripts(), new SmartScripts()]; | ||
timedActionlists[0].entryorguid = 111; | ||
timedActionlists[0].id = 1; | ||
timedActionlists[1].entryorguid = 222; | ||
timedActionlists[1].id = 2; | ||
spyOn(queryService, 'getTimedActionlists').and.returnValue(of(timedActionlists)); | ||
|
||
host.creatureId = id; | ||
host.child.ngOnChanges(); | ||
page.detectChanges(); | ||
|
||
expect(page.getDatatableCell('ngx-datatable', 0, 0).innerText).toContain(String(timedActionlists[0].entryorguid)); | ||
expect(page.getDatatableCell('ngx-datatable', 0, 1).innerText).toContain(String(timedActionlists[0].id)); | ||
expect(page.getDatatableCell('ngx-datatable', 1, 0).innerText).toContain(String(timedActionlists[1].entryorguid)); | ||
expect(page.getDatatableCell('ngx-datatable', 1, 1).innerText).toContain(String(timedActionlists[1].id)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters