Skip to content

Commit

Permalink
leave confirmMode after clicking on yielded template again
Browse files Browse the repository at this point in the history
  • Loading branch information
pogopaule committed Mar 24, 2015
1 parent daea455 commit d91dc90
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addon/components/confirm-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default Ember.Component.extend({

actions: {
click: function() {
this.set('confirmMode', true);
this.set('confirmMode', !this.get('confirmMode'));
},
confirm: function() {
this.set('confirmMode', false);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-confirm-extension",
"version": "0.0.2",
"version": "0.0.3",
"description": "Extend any template block by a confirmation \"bubble\"",
"directories": {
"doc": "doc",
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/components/confirm-extension-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ test('click on decline leaves the confirm mode and hides the bubble', function(a
assert.equal($component.find('.ece-bubble').length, 0);
});

test('click on the yielded template leaves the confirm mode and hides the bubble', function(assert) {
assert.expect(3);

var component = this.subject({
confirmMode: true
});

var $component = this.render();
assert.equal($component.find('.ece-bubble').length, 1);
$component.find('span')[0].click();
assert.equal(component.get('confirmMode'), false);
assert.equal($component.find('.ece-bubble').length, 0);
});

test('click on confirm triggers the confirmAction, leaves confirmMode and hides bubble', function(assert) {
assert.expect(4);

Expand Down

0 comments on commit d91dc90

Please sign in to comment.