Skip to content

Commit

Permalink
feat(gce): avoid empty tags
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarulg committed Sep 24, 2024
1 parent 53ae2aa commit e6ad49a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<b>Resource Manager Tags</b>
<help-field key="gce.serverGroup.resourceManagerTags"></help-field>
</div>
<map-editor model="vm.command.resourceManagerTags" add-button-label="Add New Tag" allow-empty="true"></map-editor>
<map-editor model="vm.command.resourceManagerTags" add-button-label="Add New Tag" allow-empty="false"></map-editor>
</div>
<div class="form-group">
<div class="sm-label-left">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Directive: GCE Group Advanced Settings Selector', function () {
);
this.gceTagManager = gceTagManager;
this.scope = $rootScope.$new();
this.scope.command = { instanceMetadata: [], tags: [], labels: [], authScopes: [] };
this.scope.command = { instanceMetadata: [], tags: [], labels: [], authScopes: [], resourceManagerTags: [] };
this.elem = angular.element(
'<gce-server-group-advanced-settings-selector command="command"></gce-server-group-advanced-settings-selector>',
);
Expand Down Expand Up @@ -55,19 +55,4 @@ describe('Directive: GCE Group Advanced Settings Selector', function () {
expect(this.scope.command.tags[0].value).toEqual('myTag2');
expect(this.gceTagManager.updateSelectedTags).toHaveBeenCalled();
});

it('should correctly add ResourceManagerTags to the command', function () {
expect(this.scope.command.resourceManagerTags.length).toEqual(0);

this.elem.find('table.resourceManagerTags button').trigger('click');
this.scope.$apply();
expect(this.scope.command.tags.length).toEqual(1);

this.elem.find('table.resourceManagerTags input').val('myTag').trigger('input');
this.scope.$apply();

expect(this.scope.command.tags.length).toEqual(1);
expect(this.scope.command.tags[0].value).toEqual('myTag');
});

});

0 comments on commit e6ad49a

Please sign in to comment.