Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix(ng:list) : ng-list directive separator bug fix. #1841

Closed
wants to merge 3 commits into from

Conversation

ashishgithub
Copy link

Issue : ng-list separator getting overridden by ',' .

@ashishgithub
Copy link
Author

Firefox 18.0 (Linux) input ngList should parse text into an array FAILED
Expected 'x,y,z' to be 'x, y, z'.
n@/home/travis/build/angular/angular.js/test/ng/directive/inputSpec.js:919

This test case is failing since original code was appending space after hard coded comma separator which I corrected by specifying only the given separator.

Is space supposed to be append by $formatters function ?

@petebacondarwin
Copy link
Contributor

I think this is a case for changing the spec. But you still need to add
extra specs for the new functionality.

On 19 January 2013 12:15, ashish [email protected] wrote:

Firefox 18.0 (Linux) input ngList should parse text into an array FAILED
Expected 'x,y,z' to be 'x, y, z'.
n@/home/travis/build/angular/angular.js/test/ng/directive/inputSpec.js:919

This test case is failing since original code was appending space after
hard coded comma separator which I corrected by specifying the given
separator.

Is space is supposed to be append by $formatters function ?


Reply to this email directly or view it on GitHubhttps://github.com//pull/1841#issuecomment-12454111.

@ashishgithub
Copy link
Author

Hi ,

I have also resolved this issue by applying new patch but it caused some
strange build errors which
were due to instability of Travis-CI as you told.

May I go ahead and reapply the patch if Travis is stabilized ?

Thanks,
Ashish

On Sat, Jan 19, 2013 at 8:04 PM, Pete Bacon Darwin <[email protected]

wrote:

I think this is a case for changing the spec. But you still need to add
extra specs for the new functionality.

On 19 January 2013 12:15, ashish [email protected] wrote:

Firefox 18.0 (Linux) input ngList should parse text into an array FAILED
Expected 'x,y,z' to be 'x, y, z'.
n@/home/travis/build/angular/angular.js/test/ng/directive/inputSpec.js:919

This test case is failing since original code was appending space after
hard coded comma separator which I corrected by specifying the given
separator.

Is space is supposed to be append by $formatters function ?


Reply to this email directly or view it on GitHub<
https://github.com/angular/angular.js/pull/1841#issuecomment-12454111>.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1841#issuecomment-12455611.

@ashishgithub
Copy link
Author

The build is still giving failure after re-applying patch .
Can you let me know what's going wrong ?

@petebacondarwin
Copy link
Contributor

Personally I think that this needs some more thought. I would expect that converting to a list and back again should be idempotent. So to hack in a space seems dubious. It would seem to me that one should either live without spaces being magically added, in which case the current spec is wrong and needs changing. Or that there should be some option to get the directive to add spaces when serializing if that is what you want.

In either case you still need to add new unit test specs for the new functionality that you have added - i.e. that the separator will be used in serializing rather than ', '.

@petebacondarwin
Copy link
Contributor

By the way the Travis build failing has nothing to do with your code. If you look the unit tests are all passing.

@pkozlowski-opensource
Copy link
Member

In fact there is one more tricky issue here: ngList can take a regexp to be used for splitting input. This works perfectly for input->model transformation but we still need to hard-code something (comma?) while doing model->view transformation if a regexp was provided for splitting.

@ashishgithub
Copy link
Author

@petebacondarwin , you mean to say I need to add test specs along with commits for test coverage ? What about the test cases getting failed due to original implementation ?

@petebacondarwin
Copy link
Contributor

Yes, and if the original test spec is incorrect it should be changed.

On 22 January 2013 06:00, ashish [email protected] wrote:

@petebacondarwin https://github.com/petebacondarwin , you mean to say I
need to add test specs along with commits for test coverage ? What about
the test cases getting failed due to original implementation ?


Reply to this email directly or view it on GitHubhttps://github.com//pull/1841#issuecomment-12531768.

@ashishgithub
Copy link
Author

@pkozlowski-opensource, I would like to summarize my proposed implementation which would take care of reg-expression also.

Case-1) If ng-list is an reg-expr then we can take an extra attribute for separator (default to comma) so that model to view binding can work consistently. I think leaving it up-to user what he wants to see is a better idea here.
e.g. : ng-list-delimiter=";"

Case-2) If ng-list is not reg-expr then simply we use original delimeter provided in ng-list.

Let me know your opinion about it !!!

@petebacondarwin , can you give some suggestions ?

@ashishgithub ashishgithub reopened this Feb 5, 2013
@mhevery
Copy link
Contributor

mhevery commented Feb 15, 2013

Need to see a failing test case. All of the tests pass on or CI server, so I am not sure why you think we need this change.

@ashishgithub
Copy link
Author

Hi Misko,

Unfortunately test-cases for ng-list do not cover the case to ensure whether model->view binding is ok or not with ng-list as a reg-expresson, hence it passed all test-cases.

That is what I am trying to convey in my previous comments.

Let me know you views on it.

@pkozlowski-opensource
Copy link
Member

  • Contributor signed CLA now or in the past (if you just signed, leave a comment here with your real name)
  • PR doesn't introduce new api
  • PR doesn't contain a breaking change
  • PR contains unit tests
  • PR contains e2e tests (if suitable)
  • PR contains documentation update (if suitable)
  • PR passes all tests on Travis (sanity)
  • PR passes all tests on ci.angularjs.org (cross-browser compatibility)
  • PR is rebased against recent master
  • PR is squashed into one commit per logical change
  • PR's commit messages are descriptive and allows us to autogenerate release notes (required commit message format)
  • All changes requested in review have been implemented

@pkozlowski-opensource
Copy link
Member

@ashishgithub Your PR needs to contain a test that should be failing without your fix. This way we can now that your commit fixes an issue demonstrated by a test.

This PR will require a bit of additional work before it can be considered for merging, I've included a checklist for you. But you should really start with a test.

@jbdeboer
Copy link
Contributor

There hasn't been any work on this PR recently. I'm closing it to keep the PR queue clean. Please re-open the PR when you continue work on it.

Thanks!

@jbdeboer jbdeboer closed this Apr 11, 2013
@gunnarlium
Copy link

Are you actually closing a PR that fixes an obvious and easily verifiable bug? Shouldn't at least the issue remain open? If having a clean PR queue is more important than actually fixing bugs, I have to say I'm a bit worried about the priorities of the project.

@alexspurling
Copy link

I've created a new pull request that fixes this issue: #2561

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants