-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Inverser les en-têtes de deux colonnes et conditionne un des…
Showing
7 changed files
with
176 additions
and
8 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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Component from '@glimmer/component'; | ||
export default class AssessmentList extends Component { | ||
get displayParticipationCount() { | ||
return this.args.campaign.multipleSendings; | ||
} | ||
} |
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
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
68 changes: 68 additions & 0 deletions
68
orga/tests/integration/components/campaign/results/assessment-row_test.js
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { render } from '@1024pix/ember-testing-library'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
import { module, test } from 'qunit'; | ||
import sinon from 'sinon'; | ||
|
||
import setupIntlRenderingTest from '../../../../helpers/setup-intl-rendering'; | ||
|
||
module('Integration | Component | Campaign::Results::AssessmentRow', function (hooks) { | ||
setupIntlRenderingTest(hooks); | ||
|
||
hooks.beforeEach(function () { | ||
this.set('noop', sinon.stub()); | ||
}); | ||
|
||
module('when the campaign has multiple sending enabled', function () { | ||
test('it should display shared result count', async function (assert) { | ||
// given | ||
const participation = { sharedResultCount: 10 }; | ||
|
||
this.set('displayParticipationCount', true); | ||
this.set('campaign', {}); | ||
this.set('participation', participation); | ||
|
||
// when | ||
const screen = await render( | ||
hbs`<Campaign::Results::AssessmentRow | ||
@hasStages={{this.campaign.hasStages}} | ||
@hasBadges={{this.campaign.hasBadges}} | ||
@hasExternalId={{this.campaign.hasExternalId}} | ||
@participation={{this.participation}} | ||
@campaignId={{this.campaign.id}} | ||
@stages={{this.campaign.stages}} | ||
@onClickParticipant={{this.noop}} | ||
@displayParticipationCount={{this.displayParticipationCount}} | ||
/>`, | ||
); | ||
// then | ||
assert.ok(screen.getByText('10')); | ||
}); | ||
}); | ||
|
||
module('when the campaign has multiple sending not enabled', function () { | ||
test('it should not display shared result count', async function (assert) { | ||
// given | ||
const participation = { sharedResultCount: 10 }; | ||
|
||
this.set('displayParticipationCount', false); | ||
this.set('campaign', {}); | ||
this.set('participation', participation); | ||
|
||
// when | ||
const screen = await render( | ||
hbs`<Campaign::Results::AssessmentRow | ||
@hasStages={{this.campaign.hasStages}} | ||
@hasBadges={{this.campaign.hasBadges}} | ||
@hasExternalId={{this.campaign.hasExternalId}} | ||
@participation={{this.participation}} | ||
@campaignId={{this.campaign.id}} | ||
@stages={{this.campaign.stages}} | ||
@onClickParticipant={{this.noop}} | ||
@displayParticipationCount={{this.displayParticipationCount}} | ||
/>`, | ||
); | ||
// then | ||
assert.notOk(screen.queryByText('10')); | ||
}); | ||
}); | ||
}); |
32 changes: 32 additions & 0 deletions
32
orga/tests/unit/components/campaign/results/assessment-list_test.js
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { setupTest } from 'ember-qunit'; | ||
import { module, test } from 'qunit'; | ||
|
||
import createGlimmerComponent from '../../../../helpers/create-glimmer-component'; | ||
|
||
module('Unit | Component | AssessmentList', (hooks) => { | ||
setupTest(hooks); | ||
|
||
let component; | ||
|
||
hooks.beforeEach(function () { | ||
component = createGlimmerComponent('component:campaign/results/assessment-list'); | ||
}); | ||
|
||
module('get displayParticipationCount', () => { | ||
test('should return true when campaign has multiple sending enabled', function (assert) { | ||
//when | ||
component.args.campaign = { multipleSendings: true }; | ||
|
||
// then | ||
assert.true(component.displayParticipationCount); | ||
}); | ||
|
||
test('should return false when campaign has multiple sending not enabled', function (assert) { | ||
//when | ||
component.args.campaign = { multipleSendings: false }; | ||
|
||
// then | ||
assert.false(component.displayParticipationCount); | ||
}); | ||
}); | ||
}); |
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