-
Notifications
You must be signed in to change notification settings - Fork 191
feat: Programmatically toggle containers #154
feat: Programmatically toggle containers #154
Conversation
Enables: - programmatically un/collapse containers using collapsed attribute - collapsing containers on app start (see comment in directive uiLayoutLoaded) - introduces concept of "central" container - add animation for collapsing - fixes angular-ui#129, angular-ui#100 - few formatting changes
@petrsimon created a plunker to demonstrate these fixes here: http://plnkr.co/edit/u8hJG42cMQDg9KiG86as Unfortunately a couple of tests are failing, @petrsimon have you had a chance to look at the failing tests? |
Weird. On my system, I see 61 test running, all passing. Can you tell me which ones? |
It looks like it's the splitMove tests have a look at the log here for more detail: https://travis-ci.org/angular-ui/ui-layout/builds/88887198 |
Ah, thanks. I've missed that. I thought it's just the jshint, since it's all passing on my computer. |
I see, it's failing on Firefox 31, I've got it passing on 41. Are we supposed to support browser that old? |
I'll defer to @SomeKittens for that question but I would assume so as all the other angular-ui stuff on travis seems to be running tests in that version. |
Right. That naturally makes sense. Just not sure how to go about fixing this... |
Just ran the test with FF31. |
I just pulled down your branch to my local and the same tests fail for me in chrome 46 and firefox 41 but pass in phantomjs. Any ideas? I may be able to do a bit of digging tomorrow. |
OK, I can reproduce it now, only on Chrome, though... (on OSX) (confession: actually I didn't have stable chrome installed and I forgot to turn Canary on, that's why I missed it). Thanks a lot and also for the eagerness to dig! It bugged me, so I had to take a quick look. It's caused by rounding down. To recap what is going on in the test:
The test is working outside this branch, because originally How about if in case of odd numbers, we add the remainder to the last 'auto' sized container and adjust the tests. |
Opened #156 to cover browser testing. And yeah, rounding is fun! I'm fine with adjusting the tests to cover reasonable off-by-one cases due to rounding. |
Thanks @SomeKittens! The current tests are simply testing a bug, which is caused by rounding in the code (not default sub-pixel value rounding in the browsers). Hackish way to fix the test would be to resize the viewport in But I guess the best way to do it is to add the dangling pixel to the last auto sized element. |
I think adding the dangling pixel to the last auto sized element makes sense. |
c = ctrl.containers[i]; | ||
opts.sizes[i] = c.isCentral ? 'auto' : c.collapsed ? '0px' : optionValue(c.uncollapsedSize) || 'auto'; | ||
opts.minSizes[i] = optionValue(c.minSize); | ||
opts.maxSizes[i] = optionValue(c.maxSize); | ||
|
||
if(opts.sizes[i] != 'auto') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!== vs !=
I'm also fine with adjusting the tests to deal with the scenario. I just did an initial review I found a few style issues. I'm going to try and review it again to dig into more of what you're doing etc before I sign off, but initial review looks good. Should be able to get it merged in pretty quickly after the tests are fixed. |
I didn't want to mess with the style too much, since I've got more ideas in that area and thought I'll do another PR for that, but those few small changes you've mentioned, I'll change right away. I've got the dangling pixel basically taken care of, just have to fix the test and see that it doesn't brake anything else. |
Yeah, there's a few lingering style issues I'd like to fix but haven't yet. Thanks for following what you saw. Good news about the pixel! Looking forward to it. |
Will do my best! :) |
Remainder from rounding down of autoSize value is added to the last container of a layout. - Tests adjusted to account for the new container sizing - Few style fixes as suggested during PR review
Please have a look. |
Latest commit LGTM |
My pleasure! Let's see if others find anything fishy... |
LGTM as well, it looks like jshint failed on your build though. Fix and we'll accept. Also, thank you for putting up with all the back and forth, your contribution is definitely welcome! |
This is temporary formatting change, which should later be revised.
No worries, happy to contribute. |
feat: Programmatically toggle containers
PR accepted, this project needs a lot of TLC if you'd like to submit additional pull requests to deal with short comings etc you're more than welcome to. |
Wonderful! Thank you. I'll have couple of other ideas, so I'm planning to make issues or PRs soon. |
Enables: