Skip to content
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

add grid-list.spec.ts test for switching between ratio and fixed height #4048

Closed
wants to merge 3 commits into from

Conversation

arlowhite
Copy link

@arlowhite arlowhite commented Apr 12, 2017

This creates a unit tests that demonstrates bug #4047

EDIT: and also tries to fix the bug. However, need code review before merging.

In theory, all permutations of switching between ratio, fixed, and fit should be tested, but that's probably overkill.

exposes bug where paddingTop/height is not set back to zero when
switching tile layout modes.
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 12, 2017
@arlowhite
Copy link
Author

arlowhite commented Apr 12, 2017

I came-up with a fix (pushed to branch) that passes the test, but someone more familiar with TileStylers code should probably look at this bug.

unit-test height of MdGridList after switching ratio to fixed.
this._tileStyler.clearRowStyles(tile);
});
// clear styles set on grid by _layoutTiles()
this._setListStyle(['paddingBottom', '0px']);
Copy link
Author

@arlowhite arlowhite Apr 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code isn't as clean because it does not defer to the TileStyler implementation to clear the MdGridList styles.

But I wanted to just add a quick fix before adding another method to TileStyler.

I was thinking of changing clearRowStyles to:
clearTileStyles(tiles: MdGridTile[]): [string, string]

which would return the style to clear the grid styling using _setListStyle().

<md-grid-tile></md-grid-tile>
</md-grid-list>
</div>`})
class GirdListWithRowHeightRatio {
heightRatio: string;
rowHeight: string;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed from heightRatio to rowHeight because it more clearly indicates direct binding to rowHeight.

I'm reusing the GirdListWithRowHeightRatio test component. Is there a rule that there should only be one test Component per test; should I create a new component for the test I added?

@jelbourn
Copy link
Member

Closing this since it's become quite stale. Feel free to open a new PR if this is still relevant.

@jelbourn jelbourn closed this Jan 24, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants