Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add coverage for recently added features #718

Merged
merged 2 commits into from
May 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,14 @@
[tooltip]="CONDITION_VALUE_2_TOOLTIPS[conditionType]"
></i>
<keira-flags-selector-btn
id="queststate-flag-selector"
*ngIf="showQuestState"
[control]="editorService.form.controls.ConditionValue2"
[config]="{ flags: QUEST_STATE, name: 'ConditionValue2' }"
[modalClass]="'modal-lg'"
></keira-flags-selector-btn>
<keira-flags-selector-btn
id="rankmask-flag-selector"
*ngIf="showReactionTo"
[control]="editorService.form.controls.ConditionValue2"
[config]="{ flags: RANKMASK, name: 'ConditionValue2' }"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export class ConditionsComponent extends SingleRowEditorComponent<Conditions> {
}

get showReactionTo(): boolean {
/* istanbul ignore next */ // TODO
switch (this.conditionType) {
case CONDITION_TYPES.CONDITION_REPUTATION_RANK:
case CONDITION_TYPES.CONDITION_REACTION_TO:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { EditorPageObject } from '@keira-testing/editor-page-object';
import { Conditions } from '@keira-types/conditions.type';
import { ConditionsHandlerService } from '../conditions-handler.service';

class ConditionsPage extends EditorPageObject<ConditionsComponent> {}
class ConditionsPage extends EditorPageObject<ConditionsComponent> {
getQuestStateFlagSelector(assert = true) { return this.query(`#queststate-flag-selector`, assert); }
getRankMaskFlagSelector(assert = true) { return this.query(`#rankmask-flag-selector`, assert); }
}

describe('Conditions integration tests', () => {
let component: ConditionsComponent;
Expand Down Expand Up @@ -115,6 +118,18 @@ describe('Conditions integration tests', () => {
expect(querySpy.calls.mostRecent().args[0]).toContain(expectedQuery);
});

it('should correctly toggle flag selector according to the selected condition type', () => {
expect(page.getQuestStateFlagSelector(false)).toBeFalsy();
expect(page.getRankMaskFlagSelector(false)).toBeFalsy();

page.setSelectValueById('ConditionTypeOrReference', 5); // CONDITION_REPUTATION_RANK
expect(page.getQuestStateFlagSelector(false)).toBeFalsy();
expect(page.getRankMaskFlagSelector).toBeTruthy();

page.setSelectValueById('ConditionTypeOrReference', 47); // CONDITION_QUESTSTATE
expect(page.getQuestStateFlagSelector).toBeTruthy();
expect(page.getRankMaskFlagSelector(false)).toBeFalsy();
});
});


Expand Down