Skip to content

Commit 5657e7d

Browse files
authored
test(spinner): add transform test back (#31017)
Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> While working on the migration for the spinner to Ionic Modular, I noticed that we had a [Transform test page](https://github.com/ionic-team/ionic-framework/blob/2b5b9137fc164c2f3305e493510a884c0afbfcf0/core/src/components/spinner/test/transform/index.html#L5) without any context of why it was there. I found out that it's meant for a [bug](#19247) that was reported in v4 and we did have a [test](https://github.com/ionic-team/ionic-framework/pull/24643/changes#diff-7b7ff84d3845fbde015775aa2da960310e80f79ec01b1f4a5957d751eddce7c9R1) for it at some point but it was removed at a later date because it was [discovered](#25259) that it wasn't doing anything. So we don't have any coverage of it if there's a regression. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Added a test to prevent a regression ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> How to test: 1. Be on your local 2. Navigate to `spinner.scss` 3. Update the following code snippet: ```diff - :host(.spinner-circular) svg { + :host(.spinner-circular) { animation: spinner-circular linear infinite; } ``` 4. By making this code change, we are introducing the [original issue](https://github.com/ionic-team/ionic-framework/pull/24643/changes#diff-fa8f6fb72eceb39e2482c0dbc083f69ecdabd411be541c21947f8e8e9bf9ee48L118). 5. Run the test 6. Notice that it fails 7. Undo the code change 8. Run the test 9. Verify that it passes
1 parent cbfe7cc commit 5657e7d

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { expect } from '@playwright/test';
2+
import { configs, test } from '@utils/test/playwright';
3+
4+
/**
5+
* This behavior does not vary across directions/modes.
6+
*/
7+
configs({ directions: ['ltr'], modes: ['md'] }).forEach(({ title, config }) => {
8+
test.describe(title('spinner: transform'), () => {
9+
test('should not overwrite circular animation when transform style is applied', async ({ page }, testInfo) => {
10+
testInfo.annotations.push({
11+
type: 'issue',
12+
description: 'https://github.com/ionic-team/ionic-framework/issues/19247',
13+
});
14+
15+
await page.setContent(
16+
`
17+
<style>
18+
ion-spinner {
19+
position: absolute;
20+
left: 50%;
21+
top: 50%;
22+
transform: translate(-50%, -50%);
23+
}
24+
</style>
25+
26+
<ion-spinner name="circular"></ion-spinner>
27+
`,
28+
config
29+
);
30+
31+
const spinner = page.locator('ion-spinner');
32+
33+
// Get initial position
34+
const initialBox = await spinner.boundingBox();
35+
36+
// Wait for a few animation cycles
37+
await page.waitForTimeout(500);
38+
39+
// Get position after the cycles
40+
const finalBox = await spinner.boundingBox();
41+
42+
// The x and y coordinates should remain identical
43+
expect(initialBox!.x).toBe(finalBox!.x);
44+
expect(initialBox!.y).toBe(finalBox!.y);
45+
});
46+
});
47+
});

0 commit comments

Comments
 (0)