-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/insti-dash-improv' of https://github.com/Center…
…ForOpenScience/ember-osf-web into improve-mobile-styling-inst-dashboard * 'feature/insti-dash-improv' of https://github.com/CenterForOpenScience/ember-osf-web: Added a test with test-data elements Updates to add the project total # Conflicts: # translations/en-us.yml
- Loading branch information
Showing
4 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
app/institutions/dashboard/-components/total-count-kpi-wrapper/component-test.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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { render } from '@ember/test-helpers'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
import { setupMirage } from 'ember-cli-mirage/test-support'; | ||
import { setupIntl } from 'ember-intl/test-support'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { TestContext } from 'ember-test-helpers'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Integration | institutions | dashboard | -components | total-count-kpi-wrapper', hooks => { | ||
setupRenderingTest(hooks); | ||
setupMirage(hooks); | ||
setupIntl(hooks); | ||
|
||
hooks.beforeEach(function(this: TestContext) { | ||
const model = Object({ | ||
summaryMetrics: { | ||
userCount: 10, | ||
privateProjectCount: 10, | ||
publicProjectCount: 10, | ||
}, | ||
}); | ||
|
||
this.set('model', model); | ||
}); | ||
|
||
test('it renders the dashboard total kpis correctly', async assert => { | ||
// Given the component is rendered | ||
await render(hbs` | ||
<Institutions::Dashboard::-Components::TotalCountKpiWrapper | ||
@model={{this.model}} | ||
/> | ||
`); | ||
|
||
// Then the first total kpi is tested | ||
assert.dom('[data-test-total-count-kpi="0"]') | ||
.exists('The User Widget exists'); | ||
|
||
assert.dom('[data-test-total-count-kpi="0"]') | ||
.hasText('10 Total Users'); | ||
|
||
assert.dom('[data-test-total-count-kpi="0"] [data-test-kpi-icon]') | ||
.hasAttribute('data-icon', 'building'); | ||
|
||
// And the second total kpi is tested | ||
assert.dom('[data-test-total-count-kpi="1"]') | ||
.exists('The Project Widget exists'); | ||
|
||
assert.dom('[data-test-total-count-kpi="1"]') | ||
.hasText('20 OSF Public and Private Projects'); | ||
|
||
assert.dom('[data-test-total-count-kpi="1"] [data-test-kpi-icon]') | ||
.hasAttribute('data-icon', 'atom'); | ||
|
||
// And the third total kpi is tested | ||
assert.dom('[data-test-total-count-kpi="2"]') | ||
.exists('The Registration Widget exists'); | ||
|
||
assert.dom('[data-test-total-count-kpi="2"]') | ||
.hasText('1000 OSF Registrations'); | ||
|
||
assert.dom('[data-test-total-count-kpi="2"] [data-test-kpi-icon]') | ||
.hasAttribute('data-icon', 'flag'); | ||
|
||
// And the fourth total kpi is tested | ||
assert.dom('[data-test-total-count-kpi="3"]') | ||
.exists('The Preprint Widget exists'); | ||
|
||
assert.dom('[data-test-total-count-kpi="3"]') | ||
.hasText('10000 OSF Preprints'); | ||
|
||
assert.dom('[data-test-total-count-kpi="3"] [data-test-kpi-icon]') | ||
.hasAttribute('data-icon', 'file-alt'); | ||
|
||
// Finally there are only 4 widgets | ||
assert.dom('[data-test-total-count-kpi="4"]') | ||
.doesNotExist('There are only 4 widgets'); | ||
}); | ||
}); |
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
2 changes: 1 addition & 1 deletion
2
app/institutions/dashboard/-components/total-count-kpi-wrapper/template.hbs
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
2 changes: 1 addition & 1 deletion
2
app/institutions/dashboard/-components/total-count-kpi-wrapper/total-count-kpi/template.hbs
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