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

Update of collapse directive #4814

Closed
wants to merge 6 commits into from
Closed

Conversation

hc42
Copy link

@hc42 hc42 commented Nov 16, 2018

Update of collapse directive:

  • Added support for animations (pure bootstrap css)
  • Removed non bootstrap classes
  • Removed non bootsrap style modifications
  • Added extra event emitters (animations introduce more states)
    Unit Tests:
  • Added bootstrap css to unit tests so that we test the "real (rendered) thing"
  • Updated tests accordingly to new animations
    Docs:
  • Updated examples with animations
  • Added new events docs
  • Removed inline-block example (please look at the original bootstrap
    css examples, this is really really not required and not the right way)

Targets there Issues
#2473
#801
#3838

PR Checklist

Before creating new PR, please take a look at checklist below to make sure that you've done everything that needs to be done before we can merge it.

  • read and followed the CONTRIBUTING.md guide.
  • built and tested the changes locally.
  • added/updated tests.
  • added/updated API documentation.
  • added/updated demos.

- Added support for animations (pure bootstrap css)
- Removed non bootstrap classes
- Removed non bootsrap style modifications
- Added extra event emitters (animations introduce more states)
Unit Tests:
- Added bootstrap css to unit tests so that we test the "real (rendered) thing"
- Updated tests accordingly to new animations
Docs:
- Updated examples with animations
- Added new events docs
- Removed inline-block example (please look at the original bootstrap
css examples, this is really really not required and not the right way)
@ghost ghost added the needs review label Nov 16, 2018
@codecov
Copy link

codecov bot commented Nov 16, 2018

Codecov Report

Merging #4814 into development will increase coverage by 0.02%.
The diff coverage is 88.75%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #4814      +/-   ##
===============================================
+ Coverage        74.79%   74.82%   +0.02%     
===============================================
  Files              277      277              
  Lines             8436     8489      +53     
  Branches          1603     1617      +14     
===============================================
+ Hits              6310     6352      +42     
- Misses            1680     1681       +1     
- Partials           446      456      +10
Impacted Files Coverage Δ
src/collapse/collapse.directive.ts 89.13% <88.75%> (-8.31%) ⬇️
src/chronos/i18n/it.ts 71.42% <0%> (-28.58%) ⬇️
src/typeahead/typeahead-container.component.ts 78.04% <0%> (-4.07%) ⬇️
src/chronos/i18n/uk.ts 78.04% <0%> (-2.44%) ⬇️
src/dropdown/bs-dropdown.directive.ts 85.18% <0%> (-0.75%) ⬇️
src/chronos/i18n/cs.ts 86.44% <0%> (+1.69%) ⬆️
src/chronos/i18n/sk.ts 82.97% <0%> (+2.12%) ⬆️
src/chronos/i18n/pl.ts 74.35% <0%> (+5.12%) ⬆️
src/modal/modal-backdrop.component.ts 80.76% <0%> (+11.53%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac55b08...27325dc. Read the comment docs.

@valorkin
Copy link
Member

Looks interesting, 1 thing is missing for sure:
Enabling animation should be done via config or/and input and disabled by default.
Or it will be a breaking change

Could you please add it?

@hc42
Copy link
Author

hc42 commented Nov 27, 2018

Finally found some time to do this. I added the input property "animate" (by default false). So this introduces no breaking change. However in the original JQuery-Bootstrap the default is enabled. It would be nice to have the same default behaviour some time in the future.

@Domainv Domainv added this to the 3.1.5 milestone Jan 10, 2019
@ghost ghost assigned Domainv Jan 14, 2019
// {pattern: './scripts/test.ts', watched: false}
// ],
"node_modules/bootstrap/dist/css/bootstrap.min.css",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need this change?

Copy link
Author

Choose a reason for hiding this comment

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

Short version: Without css available nothing would work.
Longer version: Animations are already defined by the css code. I try to not "reinvent the wheel" by not reimplementing bootstraps code in angular a second time. Actually I don't understand why it's often done in the project code base. Dosen't make sense to me.

fixture.detectChanges();
};

triggerCollapse();
Copy link
Contributor

Choose a reason for hiding this comment

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

in tests need to support AAA principle (arrange, act, assert)
I'm not sure why do you need triggerCollapse();

Copy link
Author

Choose a reason for hiding this comment

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

Without calling this function the test would not be executed correctly. I grouped different steps (points in time of the execution) in subfunctions because it seamed easier to read to me and it avoided callback nesting. Due to delay of animations it is required to wait for events and then check the state. One could also extend this test to for non expected events and throw an error in this case. However this arrangement seems to be simpler to read/understand (at least to me).

@@ -350,7 +362,8 @@ describe('Component: TypeaheadContainer', () => {
});

describe('prevActiveMatch', () => {
it('should select the last item and scroll to bottom', () => {
// broken test
xit('should select the last item and scroll to bottom', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

we can't xit tests, need to fix/rewrite them

Copy link
Author

Choose a reason for hiding this comment

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

True, however this test fails in a complete different module and is not part of my changes. Sorry, but right now I don't have time to fix other bugs in other modules. You can leave the broken tests active of course.

@valorkin valorkin modified the milestones: 3.2.0, 3.2.1 Feb 4, 2019
@Domainv Domainv added this to the 3.2.2 milestone Feb 11, 2019
@Domainv Domainv removed this from the 3.3.1 milestone Feb 20, 2019
@Dassderdie
Copy link

Is there any news on this?

@Domainv
Copy link
Contributor

Domainv commented Mar 2, 2019

@Dassderdie The PR probably will be rejected
We decided to make more complex a general feature/refactor for animations of all components.

@Dassderdie
Copy link

@Domainv Thx for the response :)
Is there an ETA for the animations? It seems to me like there is a huge demand for them.

@Domainv
Copy link
Contributor

Domainv commented Mar 2, 2019

@Dassderdie For now no, general plans

@Domainv
Copy link
Contributor

Domainv commented May 27, 2019

@Domainv Domainv closed this May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants