Skip to content

Commit

Permalink
Don't show new learner group form when there are no cohorts
Browse files Browse the repository at this point in the history
This prevents attempting to create an invalid learner group
  • Loading branch information
jrjohnson committed Jul 8, 2016
1 parent 3cf4227 commit 849f17b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/templates/learner-groups.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
<h2>{{t 'general.learnerGroups'}}</h2>
</div>
<div class='actions'>
{{expand-collapse-button value=showNewLearnerGroupForm action="toggleNewLearnerGroupForm"}}
{{#if selectedProgramYear}}
{{expand-collapse-button value=showNewLearnerGroupForm action="toggleNewLearnerGroupForm"}}
{{/if}}
</div>
</div>

Expand Down
12 changes: 12 additions & 0 deletions tests/acceptance/learnergroups-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,3 +681,15 @@ test('add new learnergroup with full cohort', function(assert) {
assert.equal(getCellData(0, 1), 5, 'member count is correct');
});
});

test('no add button when there is no cohort', function(assert) {
server.create('user', {id: 4136});
server.create('school');
visit('/learnergroups');
const expandNewButton = '.actions .expand-button';

andThen(function() {
assert.equal(currentPath(), 'learnerGroups');
assert.equal(find(expandNewButton).length, 0);
});
});

0 comments on commit 849f17b

Please sign in to comment.