Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wizard/wizard-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
e.preventDefault();
$scope.$apply(function () {
// scope apply in button module
$scope.wizard[action.replace("pfWiz", "").toLowerCase()]($scope.callback);
$scope.wizard[action.replace("pfWiz", "").toLowerCase()](ctrl.callback);
});
});
};
Expand Down
21 changes: 21 additions & 0 deletions test/wizard/wizard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ describe('Component: pfWizard', function () {

$scope.data = {};

$scope.wasNextCalled = false;
$scope.nextCallback = function () {
$scope.wasNextCalled = true;
return true;
};

$scope.wasBackCalled = false;
$scope.backCallback = function () {
$scope.wasBackCalled = true;
return true;
};

Expand Down Expand Up @@ -150,6 +154,23 @@ describe('Component: pfWizard', function () {
expect(stepIndicator.text()).toBe('1B.');
});

it('should call the next callback and back callback when buttons are clicked', function () {
setupWizard('test/wizard/wizard-container.html');
var nextButton = element.find('.wizard-pf-next');
var nameBox = element.find('#new-name');
nameBox.val('test').triggerHandler('input');

expect($scope.wasNextCalled).toBe(false);
eventFire(nextButton[0], 'click');
expect($scope.wasNextCalled).toBe(true);

var backButton = element.find('#backButton');

expect($scope.wasBackCalled).toBe(false);
eventFire(backButton[0], 'click');
expect($scope.wasBackCalled).toBe(true);
});

it('should have allowed moving back to first page after input and allowed navigation', function () {
setupWizard('test/wizard/wizard-container.html');
var nextButton = element.find('.wizard-pf-next');
Expand Down