Merge pull request #10245 from jibees/10222-in-bom-dont-show-group-buy-info-if-equal-to-0

Admin, BOM: Don't display "group by size" if group by product value is actually null
This commit is contained in:
Filipe
2023-01-25 15:29:05 +00:00
committed by GitHub
2 changed files with 14 additions and 1 deletions

View File

@@ -348,6 +348,19 @@ describe "LineItemsCtrl", ->
spyOn(VariantUnitManager, "getUnitName").and.returnValue "lb"
expect(scope.formattedValueWithUnitName(2, unitsProduct, unitsVariant)).toEqual "2 lb"
describe "get group by size formatted value with unit name", ->
beforeEach ->
spyOn(VariantUnitManager, "getUnitName").and.returnValue "kg"
unitsProduct = { variant_unit: "weight", variant_unit_scale: 1000 }
it "returns the formatted value with unit name", ->
expect(scope.getGroupBySizeFormattedValueWithUnitName(1000, unitsProduct)).toEqual "1 kg"
it "handle the case when the value is actually null or empty", ->
expect(scope.getGroupBySizeFormattedValueWithUnitName(null, unitsProduct)).toEqual ""
expect(scope.getGroupBySizeFormattedValueWithUnitName("", unitsProduct)).toEqual ""
describe "updating the price upon updating the weight of a line item", ->
beforeEach ->