Skip to content

Commit

Permalink
Fix static test, civer with jasmine test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazar65 committed Dec 26, 2019
1 parent 666d4c0 commit e037d51
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ define([

isShow = typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount;

$productPrice.find('span:first').toggleClass('special-price',isShow);
$productPrice.find('span:first').toggleClass('special-price', isShow);

$product.find(this.options.slyOldPriceSelector)[isShow ? 'show' : 'hide']();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ define([
id: optionId
}]
};

widget.options = {
classes: {
optionClass: 'swatch-option'
Expand All @@ -50,6 +51,7 @@ define([
}
}
};

optionConfig = widget.options.jsonSwatchConfig[attribute.id];
html = $(widget._RenderSwatchOptions(attribute, 'option-label-control-id-1'))[0];
});
Expand All @@ -76,5 +78,25 @@ define([
expect(html.style.height).toEqual(swathImageHeight + 'px');
expect(html.style.width).toEqual(swathImageWidth + 'px');
});

it('check udate price method', function () {
var productPriceMock = {
find: jasmine.createSpy().and.returnValue({
hide: jasmine.createSpy(),
priceBox: jasmine.createSpy().and.returnValue(''),
trigger: jasmine.createSpy(),
find: jasmine.createSpy().and.returnValue({
toggleClass: jasmine.createSpy()
})
})
};

widget.element = {
parents: jasmine.createSpy().and.returnValue(productPriceMock)
};
widget._getNewPrices = jasmine.createSpy().and.returnValue(undefined);
widget._UpdatePrice();
expect(productPriceMock.find().find.calls.count()).toBe(1);
});
});
});

0 comments on commit e037d51

Please sign in to comment.