Skip to content

Commit

Permalink
spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ZitaNemeckova committed Nov 22, 2018
1 parent c26a45a commit 50ec898
Showing 1 changed file with 33 additions and 0 deletions.
@@ -0,0 +1,33 @@
describe('main-custom-button-form-component', function() {
var $componentController, vm, miqService, API, $scope;
beforeEach(module('ManageIQ'));
beforeEach(inject(function (_$componentController_, _API_, _miqService_, $rootScope) {
$componentController = _$componentController_;
API = _API_;
miqService = _miqService_;
$scope = $rootScope.$new();
spyOn(miqService, 'miqFlash');

var bindings = {genericObjectDefinitionRecordId: '1', customButtonGroupRecordId: '2', customButtonRecordId: '3', redirectUrl: '/redirect/url'};
vm = $componentController('mainCustomButtonFormController', null, bindings);
var volumeChoicesResponse = {volume_choices: [{ name : "original value" }, { name: "changed value" }]};
API.whenGET('/cloud_volume_backup/volume_form_choices').respond(volumeChoicesResponse);
vm.$onInit();
}));
describe('#saveClick', function() {
beforeEach(function(){
vm.saveClicked();
});
it('delegates miqService ajaxButton', function() {
expect(miqService.miqAjaxButton).toHaveBeenCalledWith('/cloud_volume_backup/backup_restore/1111?button=restore', vm.cloudVolumeBackupModel, { complete: false });
});
});
describe('#addClick', function() {
beforeEach(function(){
vm.addClicked();
});
it('delegates miqService ajaxButton', function() {
expect(miqService.miqAjaxButton).toHaveBeenCalledWith('/cloud_volume_backup/backup_restore/1111?button=restore', vm.cloudVolumeBackupModel, { complete: false });
});
});
});

0 comments on commit 50ec898

Please sign in to comment.