-
-
Notifications
You must be signed in to change notification settings - Fork 449
Fix swatch sort order and lowercase labels #5133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sreichel
wants to merge
38
commits into
OpenMage:main
Choose a base branch
from
sreichel:fix/5132
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
42f7734
added tests - that will fail
sreichel 06966f7
fix
sreichel acabadc
Update cypress/e2e/openmage/frontend/catalog/category.cy.js
sreichel 74b55a4
Update cypress/e2e/openmage/frontend/catalog/product.cy.js
sreichel 046fa8c
Update cypress/support/e2e.js
sreichel 30c4f90
typo
sreichel 3b309b7
Update app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php
sreichel 4896d8b
typo
sreichel 0fca36e
comment
sreichel bf78448
docblocks
sreichel 418399b
revert changes
sreichel a04ce4b
sort collection
sreichel 6e02e3d
template
sreichel 51ccb38
normalize and keep orig value
sreichel 172db87
sort by label
sreichel 8e8b770
updated test
sreichel 6d3670f
Merge branch 'main' into fix/5132
sreichel 2d5978d
fix
sreichel bce653a
typo
sreichel 51214db
phpcsfixer
sreichel 37ec404
typo
sreichel 41b6e93
test
sreichel 5985deb
fix
sreichel 294da98
Apply suggestions from code review
sreichel 81f7ae6
escape
sreichel 2bf9315
Merge remote-tracking branch 'origin/fix/5132' into fix/5132
sreichel 731bd8e
escape
sreichel 94fb4a1
revert
sreichel eb0eb47
Merge branch 'main' into fix/5132
sreichel 177081c
Merge branch 'main' into fix/5132
sreichel bd4baef
copilot-instructions.md
sreichel 6590fc2
escape
sreichel 35d061d
type hints
sreichel 18ab3f0
missing space
sreichel 5c03939
escape
sreichel 8a22330
minor
sreichel c4e46c7
fix
sreichel 2679dd5
Merge branch 'main' into fix/5132
addison74 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
44 changes: 44 additions & 0 deletions
44
app/code/core/Mage/ConfigurableSwatches/Model/String/Normalized.php
This file contains hidden or 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,44 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * @copyright For copyright and license information, read the COPYING.txt file. | ||
| * @link /COPYING.txt | ||
| * @license Open Software License (OSL 3.0) | ||
| * @package Mage_ConfigurableSwatches | ||
| */ | ||
|
|
||
| /** | ||
| * Wrapper to modify a string value with a method to get the original string value | ||
| * | ||
| * @package Mage_ConfigurableSwatches | ||
| */ | ||
| class Mage_ConfigurableSwatches_Model_String_Normalized implements Stringable | ||
|
Check warning on line 17 in app/code/core/Mage/ConfigurableSwatches/Model/String/Normalized.php
|
||
| { | ||
sreichel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /** | ||
| * The original, non-normalized string value. | ||
| */ | ||
| protected ?string $originalValue; | ||
|
|
||
| public function __construct(?string $originalValue) | ||
| { | ||
| $this->originalValue = $originalValue; | ||
| } | ||
sreichel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Get normalized string value | ||
| */ | ||
| public function __toString(): string | ||
| { | ||
| return Mage_ConfigurableSwatches_Helper_Data::normalizeKey($this->originalValue); | ||
| } | ||
sreichel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Get non-normalized original value | ||
| */ | ||
| public function getOriginalValue(): ?string | ||
sreichel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| return $this->originalValue; | ||
| } | ||
sreichel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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,23 @@ | ||
| const test = cy.openmage.test.frontend.catalog.category.config; | ||
|
|
||
| describe('Check catalog category page', () => { | ||
| beforeEach('Go to page', () => { | ||
| cy.visit(test.url); | ||
| }); | ||
|
|
||
| it('tests swatch: color', () => { | ||
| const options = 'ul.configurable-swatch-color'; | ||
| const swatchLink = 'li a.swatch-link'; | ||
| const colors = ['Charcoal', 'Khaki', 'Red', 'Royal Blue']; | ||
| const images = ['msj006t', 'msj006c-khaki', 'msj006c-red', 'msj006c-royal-blue']; | ||
|
|
||
| cy.get(options).eq(0).find(swatchLink).should('have.length', 4); | ||
|
|
||
| cy.get(options).eq(0).find(swatchLink).each((swatch, index) => { | ||
| cy.wrap(swatch).invoke('attr', 'title').should('eq', colors[index]); | ||
| cy.wrap(swatch).click(); | ||
| cy.get('img.product-collection-image-404').should('have.attr', 'src').should('include', images[index]); | ||
| cy.wait(500); | ||
| }); | ||
| }); | ||
| }) |
This file contains hidden or 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,36 @@ | ||
| const test = cy.openmage.test.frontend.catalog.product.config; | ||
|
|
||
| describe('Check catalog product page', () => { | ||
| beforeEach('Go to page', () => { | ||
| cy.visit(test.url); | ||
| }); | ||
|
|
||
| it('tests swatch: color', () => { | ||
| const options = 'ul#configurable_swatch_color'; | ||
| const swatchLink = 'li a.swatch-link'; | ||
| const colors = ['Charcoal', 'Khaki', 'Red', 'Royal Blue']; | ||
| const images = ['msj006t_4', 'msj006c-khaki', 'msj006c-red', 'msj006c-royal-blue']; | ||
|
|
||
| cy.get(options).eq(0).find(swatchLink).should('have.length', 4); | ||
|
|
||
| cy.get(options).eq(0).find(swatchLink).each((swatch, index) => { | ||
| cy.wrap(swatch).invoke('attr', 'title').should('eq', colors[index]); | ||
| cy.wrap(swatch).click(); | ||
| cy.get('img.gallery-image.visible').should('have.attr', 'src').should('include', images[index]); | ||
| cy.wait(500); | ||
| }); | ||
| }); | ||
|
|
||
| it('tests swatch: size', () => { | ||
| const options = 'ul#configurable_swatch_size'; | ||
| const swatchLink = 'li a.swatch-link'; | ||
| const sizes = ['XS', 'S', 'M', 'L', 'XL']; | ||
|
|
||
| cy.get(options).eq(0).find(swatchLink).should('have.length', 5); | ||
|
|
||
| cy.get(options).eq(0).find(swatchLink).each((swatch, index) => { | ||
| cy.get(options).eq(0).contains(sizes[index]).should('exist'); | ||
| cy.wrap(swatch).invoke('attr', 'title').should('eq', sizes[index]); | ||
| }); | ||
| }); | ||
| }) |
This file contains hidden or 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 hidden or 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 hidden or 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,5 @@ | ||
| const test = cy.openmage.test.frontend.catalog.category; | ||
sreichel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| test.config = { | ||
| url: cy.openmage.test.frontend.homepage._url + 'men/shirts.html' | ||
| } | ||
This file contains hidden or 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,5 @@ | ||
| const test = cy.openmage.test.frontend.catalog.product; | ||
|
|
||
| test.config = { | ||
| url: cy.openmage.test.frontend.homepage._url + 'men/shirts/plaid-cotton-shirt-476.html' | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.