Skip to content

Commit 7583547

Browse files
fixed test
1 parent 93f4508 commit 7583547

1 file changed

Lines changed: 27 additions & 7 deletions

File tree

packages/frontend/tests/integration/components/user-profile-test.gjs

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,19 @@ module('Integration | Component | user-profile', function (hooks) {
100100
const user = this.server.create('user');
101101
const userModel = await this.owner.lookup('service:store').findRecord('user', user.id);
102102
this.set('user', userModel);
103+
this.set('showCalendar', false);
104+
this.set('setShowCalendar', () => {
105+
this.set('showCalendar', !this.showCalendar);
106+
});
103107

104108
await render(
105109
<template>
106110
<UserProfile
107111
@user={{this.user}}
108112
@canUpdate={{false}}
109113
@canCreate={{false}}
114+
@showCalendar={{this.showCalendar}}
115+
@setShowCalendar={{this.setShowCalendar}}
110116
@isManagingBio={{false}}
111117
@setIsManagingBio={{(noop)}}
112118
@isManagingRoles={{false}}
@@ -125,14 +131,28 @@ module('Integration | Component | user-profile', function (hooks) {
125131
</template>,
126132
);
127133

128-
assert.notOk(component.calendar.isVisible);
129-
assert.strictEqual(component.actions.calendarToggle.firstLabel.text, 'Hide Calendar');
130-
assert.ok(component.actions.calendarToggle.firstButton.isChecked);
131-
assert.strictEqual(component.actions.calendarToggle.secondLabel.text, 'Show Calendar');
132-
assert.notOk(component.actions.calendarToggle.secondButton.isChecked);
134+
assert.notOk(component.calendar.isVisible, 'calendar is not visible');
135+
assert.strictEqual(
136+
component.actions.calendarToggle.firstLabel.text,
137+
'Hide Calendar',
138+
'first toggle button label is correct',
139+
);
140+
assert.ok(
141+
component.actions.calendarToggle.firstButton.isChecked,
142+
'first toggle button is checked',
143+
);
144+
assert.strictEqual(
145+
component.actions.calendarToggle.secondLabel.text,
146+
'Show Calendar',
147+
'second toggle button label is correct',
148+
);
149+
assert.notOk(
150+
component.actions.calendarToggle.secondButton.isChecked,
151+
'second toggle button is not checked',
152+
);
133153
await component.actions.calendarToggle.secondButton.click();
134-
assert.ok(component.calendar.isVisible);
154+
assert.ok(component.calendar.isVisible, 'calendar is visible after toggle');
135155
await component.actions.calendarToggle.firstButton.click();
136-
assert.notOk(component.calendar.isVisible);
156+
assert.notOk(component.calendar.isVisible, 'calendar is not visible after toggle');
137157
});
138158
});

0 commit comments

Comments
 (0)