Skip to content

Commit

Permalink
Merge pull request #1510 from AllenBW/BZ/#1646925-missing-tag-values
Browse files Browse the repository at this point in the history
Unshift the placeholder message rather onto filtered tags
  • Loading branch information
himdel authored Dec 11, 2018
2 parents 26f7cca + cddca29 commit 7cf8ddc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/app/shared/tagging/tagging.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function TaggingController ($scope, $filter, $q, $log, CollectionsApi, TaggingSe
$scope.$watch('vm.tags.selectedCategory', function () {
vm.tags.filtered = $filter('filter')(vm.tags.all, matchCategory)
if (vm.tags.filtered) {
vm.tags.filtered[0] = placeholderCategorization
vm.tags.filtered.unshift(placeholderCategorization)
vm.tags.selectedTag = vm.tags.filtered[0]
vm.showTagDropdowns = !vm.readOnly
}
Expand Down
14 changes: 7 additions & 7 deletions client/app/shared/tagging/tagging.component.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('Component: taggingWidget', () => {

let tagsOfCategorySelect = element.find('.tag-value-select')
let tagsOfCategory = angular.element(tagsOfCategorySelect).find('option')
expect(tagsOfCategory.length).to.be.eq(6) // 6 Auto Approve options
expect(tagsOfCategory.length).to.be.eq(7) // 6 Auto Approve options
expect(tagsOfCategory[0].selected).to.be.eq(true)

done()
Expand All @@ -88,7 +88,7 @@ describe('Component: taggingWidget', () => {
// Select tag category 'Department' and tag 'Accounting'
isoScope.vm.tags.selectedCategory = isoScope.vm.tags.categories[8]
isoScope.$digest()
isoScope.vm.tags.selectedTag = isoScope.vm.tags.filtered[1]
isoScope.vm.tags.selectedTag = isoScope.vm.tags.filtered[2]
isoScope.$digest()

expect(isoScope.vm.tags.selectedTag.name).to.be.eq('/managed/department/accounting')
Expand All @@ -100,8 +100,8 @@ describe('Component: taggingWidget', () => {

let tagsOfCategorySelect = element.find('.tag-value-select')
let tagsOfCategory = angular.element(tagsOfCategorySelect).find('option')
expect(tagsOfCategory[1].text).to.be.eq('Accounting')
expect(tagsOfCategory[1].selected).to.be.eq(true)
expect(tagsOfCategory[2].text).to.be.eq('Accounting')
expect(tagsOfCategory[2].selected).to.be.eq(true)

// should be 2 existing tags
let tagsOfItem = element.find('.pficon-close')
Expand Down Expand Up @@ -130,7 +130,7 @@ describe('Component: taggingWidget', () => {
// Select tag category 'Service Level' and tag 'Platinum'
isoScope.vm.tags.selectedCategory = isoScope.vm.tags.categories[24]
isoScope.$digest()
isoScope.vm.tags.selectedTag = isoScope.vm.tags.filtered[3]
isoScope.vm.tags.selectedTag = isoScope.vm.tags.filtered[4]
isoScope.$digest()

expect(isoScope.vm.tags.selectedTag.name).to.be.eq('/managed/service_level/platinum')
Expand All @@ -142,8 +142,8 @@ describe('Component: taggingWidget', () => {

let tagsOfCategorySelect = element.find('.tag-value-select')
let tagsOfCategory = angular.element(tagsOfCategorySelect).find('option')
expect(tagsOfCategory[3].text).to.be.eq('Platinum')
expect(tagsOfCategory[3].selected).to.be.eq(true)
expect(tagsOfCategory[4].text).to.be.eq('Platinum')
expect(tagsOfCategory[4].selected).to.be.eq(true)

// This should replace Service Level Gold with Service Level Platinum
let addItem = element.find('.fa-plus')
Expand Down

0 comments on commit 7cf8ddc

Please sign in to comment.