-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8287 from magento-l3/PR-2023-05-08
Pr 2023 05 08
- Loading branch information
Showing
4 changed files
with
130 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
.../tests/app/code/Magento/ConfigurableProduct/adminhtml/js/variations/steps/summary.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
|
||
/* eslint max-nested-callbacks: 0 */ | ||
/* jscs:disable jsDoc*/ | ||
|
||
define([ | ||
'Magento_ConfigurableProduct/js/variations/steps/summary' | ||
], function (Summary) { | ||
'use strict'; | ||
|
||
describe('Magento_ConfigurableProduct/js/variations/steps/summary', function () { | ||
let model, quantityFieldName, productDataFromGrid, productDataFromGridExpected; | ||
|
||
beforeEach(function () { | ||
quantityFieldName = 'quantity123'; | ||
model = new Summary({quantityFieldName: quantityFieldName}); | ||
|
||
productDataFromGrid = { | ||
sku: 'testSku', | ||
name: 'test name', | ||
weight: 12.12312, | ||
status: 1, | ||
price: 333.333, | ||
someField: 'someValue', | ||
quantity: 10 | ||
}; | ||
|
||
productDataFromGrid[quantityFieldName] = 12; | ||
|
||
productDataFromGridExpected = { | ||
sku: 'testSku', | ||
name: 'test name', | ||
weight: 12.12312, | ||
status: 1, | ||
price: 333.333 | ||
}; | ||
}); | ||
|
||
describe('Check prepareProductDataFromGrid', function () { | ||
|
||
it('Check call to prepareProductDataFromGrid method with qty', function () { | ||
productDataFromGrid.qty = 3; | ||
productDataFromGridExpected[quantityFieldName] = 3; | ||
const result = model.prepareProductDataFromGrid(productDataFromGrid); | ||
|
||
expect(result).toEqual(productDataFromGridExpected); | ||
}); | ||
|
||
|
||
it('Check call to prepareProductDataFromGrid method without qty', function () { | ||
const result = model.prepareProductDataFromGrid(productDataFromGrid); | ||
|
||
expect(result).toEqual(productDataFromGridExpected); | ||
}); | ||
}); | ||
}); | ||
}); |