-
-
Notifications
You must be signed in to change notification settings - Fork 120
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 dropdown formatter example #309
Conversation
@@ -11,13 +11,14 @@ import { | |||
Formatters, | |||
GridOption, | |||
OnEventArgs, | |||
} from './../modules/angular-slickgrid'; | |||
} from 'angular-slickgrid'; |
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.
you cannot do that here, you need to put back previous code. This is the lib and we need to reference it, it is not installed as a node_modules
but instead is used directly
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.
you're right
args, | ||
actionColumnIndex: 6, | ||
parent : this, | ||
$ |
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.
there's no need to pass the $
, you can use declare var $: any;
in the Service.
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.
Okay
536f0a0
to
b477ecd
Compare
Codecov Report
@@ Coverage Diff @@
## master #309 +/- ##
==========================================
- Coverage 97.28% 96.85% -0.43%
==========================================
Files 135 137 +2
Lines 7644 7693 +49
Branches 2593 2598 +5
==========================================
+ Hits 7436 7450 +14
- Misses 208 243 +35
Continue to review full report at Codecov.
|
4b37218
to
682e9da
Compare
@@ -18,6 +18,8 @@ import { CustomAngularComponentEditor } from './custom-angularComponentEditor'; | |||
import { CustomAngularComponentFilter } from './custom-angularComponentFilter'; | |||
import { CustomTitleFormatterComponent } from './custom-titleFormatter.component'; | |||
import { FilterNgSelectComponent } from './filter-ng-select.component'; | |||
import { DropDownService } from './dropdown.service'; |
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.
Your new Service doesn't seem to be part of the providers
of the App Module, is that something you forgot to do? You don't seem to instantiate that Service but instead using it as a static Service, I'm not sure that is a good idea since you won't be able to use Dependency Injection in the future
df23679
to
8c5fb14
Compare
The last thing we can do is to create dropdownFormatter like you did iconFormatter defined at src\app\modules\angular-slickgrid\formatters\iconFormatter.ts |
6bc77b3
to
982cacd
Compare
If you add something to the library code itself (the Formatter), you will need to add Unit Tests as well. There isn't any unit tests for the examples but all the lib is fully tested (what I have for the Examples are some E2E tests). You can take a look at the Formatter I see that your last commit decreased the test code coverage - Coverage 97.28% 97.22% -0.06% I'm also wondering if the name you chose for the Formatter is a little too generic, it doesn't represent that it's a Bootstrap Dropdown component. I'm not sure of a better name, but I'd like to make it a bit clearer that it's not a regular dropdown... maybe |
982cacd
to
5973431
Compare
I did not realize that you use boostrap3, all my updates were working fine in my project but when I tried to create a PR here there was bugs.. |
5973431
to
afd1c84
Compare
My library works with both version of Bootstrsap 3-4. The lib itself was written with Bootstrap 3 but when I want to test BS4, I use the Angular-Slickgrid-Demos for BS4. Usually just passing the css classes for both versions makes it work for both version. |
Did you test my updates, does it work fine? |
afd1c84
to
5f639fd
Compare
5f639fd
to
ef7802a
Compare
Didn't have time yet, this is mostly just an example |
|
||
|
||
interface DropDownServiceParams { | ||
grid: AngularGridInstance, |
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.
You don't need to pass this grid
object, you can get it instead from the SharedService
, see this line as example
constructor(... sharedService: SharedService) {}
...
this.sharedService.grid;
I see you changed the code a lot and added a new Service, that is all fine but again I'll ask to add necessary Jest Unit Tests for this new Service. I didn't have a chance to try this yet, I'll give it a try next week. Thanks |
37d1561
to
a038716
Compare
describe('Render method', () => { | ||
const service = BsDropDownService; | ||
it('should show check is the dropdown is displayed after clic', () => { | ||
expect(true).toBe(true); |
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.
I hope you will eventually add more tests than this, because I won't accept this PR as it is. Please provide sufficient Jest Unit Tests before I can review and accept this PR
Superseded by #314 @jeremielodi There is 1 major thing to note about your code, you cannot export the |
Thanks |
@ghiscoding, I wonder if it's possible to have the component(page) context inside a formatter. |
You can refresh your code and play with it and make other contributions if you wish in the future. I'm about to release a new version (in the next few minutes) and I will go with the code I have now. I'm certainly open for PR that might enhance the lib and/or the examples. Thanks |
Also up vote ⭐️ if you like the lib and haven't up voted yet, thanks 😸 |
Found out that the dropdown was not working with Bootstrap 4, I made a commit to fix that in the EDIT I actually refactored the Service again and added almost full test coverage now with this commit |
@jeremielodi |
using a separate service to manage dropdown.
