Skip to content

Fix form.key issues #874

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

Merged
merged 7 commits into from
May 1, 2017
Merged

Conversation

mnzaki
Copy link
Contributor

@mnzaki mnzaki commented Apr 29, 2017

Description

Generate proper form keys for arrays of strings and arrays of objects, and add some tests for it.
This also depends on a fix in angular-schema-form-bootstrap, specifically removing the sf-key-controller from fieldset.html

Fixes Related issues

Issue #870

Checklist

  • I have read and understand the CONTRIBUTIONS.md file
  • I have searched for and linked related issues
  • I have created test cases to ensure quick resolution of the PR is easier
  • I am NOT targeting main branch
  • I did NOT include the dist folder in my PR

@json-schema-form/angular-schema-form-lead

mnzaki added 5 commits April 28, 2017 10:44
mocha reporter is better than dots + progress
but especially for diff output as it is needed to see deep comparisons
between arrays/objects (for example while looking at wrong keys in the
sf-field.directive tests)
@mnzaki
Copy link
Contributor Author

mnzaki commented Apr 29, 2017

Note that tests will fail because this depends on json-schema-form/angular-schema-form-bootstrap#42

@Anthropic
Copy link
Member

@mnzaki I added your bootstrap change and it is still failing on strings, is something else missing?
✔ should generate correct form keys for array of objects
✔ should generate correct form keys for array of objects with user specified form
✖ should generate correct form keys for array of strings

Oh and thanks for noticing the dupe of tests, they were previously breaking the loop so I had to split them out to update the loop logic and forgot to clean them up.

@mnzaki
Copy link
Contributor Author

mnzaki commented Apr 30, 2017

It needs to be built as the karma tests use the built file in dist/, and I did not include that in the PR as required. The "array of objects" tests pass as they do not need changes in angular-schema-form, they only require the bootstrap fix.

@mnzaki
Copy link
Contributor Author

mnzaki commented Apr 30, 2017

Also there's one more fix missing here, the issue that I explained in this comment about these lines:

        scope.initialForm = Object.assign({}, sfSchema.lookup['f' + attrs.sfField]);
/*->*/  scope.form = sfSchema.lookup['f' + attrs.sfField];

I was hesitant about fixing this as well as it might introduce bugs in projects using ASF and depending on this unexpected side effect (ie, updating form object and getting things changed without broadcasting a redraw event). What do you think?

@Anthropic
Copy link
Member

@mnzaki I did the build, that's why it started passing two of the three, it was failing all three originally :)

@mnzaki
Copy link
Contributor Author

mnzaki commented Apr 30, 2017

@Anthropic I don't really fully know how the tests are run on Travis. But on formKeyFixes branch the angular-schema-form build inside dist is not updated, if you make a clean checkout and run the tests they will fail, but if you npm run build the tests will pass.

You built angular-schema-form-bootstrap and pushed that to the development branch, so I don't even know how that affected the tests running on my formKeyFixes branch....

@Anthropic
Copy link
Member

@mnzaki travisci clones the whole repo, then apply and merge the pr before running the tests, you can see the output here https://travis-ci.org/json-schema-form/angular-schema-form/pull_requests I believe that's visible to anyone. You can see that after I committed the re-built dist folder the test result changed, objects and strings failed in the last run but then only strings the next time. I had a quick look last night, but I need more time tonight to hopefully fix the strings, seems like there just a duplication of the key I need to eliminate.

@mnzaki
Copy link
Contributor Author

mnzaki commented May 1, 2017

@Anthropic yes and then it runs the tests through npm run test which uses dist/angular-schema-form.js (not from src/) so it needs to be built and committed as I did just now, then tests pass.

@Anthropic Anthropic merged commit 3c5680a into json-schema-form:development May 1, 2017
@Anthropic
Copy link
Member

@mnzaki ah d'oh sorry was in too much of a rush to notice, I really should update the tests to run a build into a folder ignored by git... one day... thanks for taking the time to make sense for me! :)

I will try to look at your other suggestion shortly.

@mnzaki
Copy link
Contributor Author

mnzaki commented May 5, 2017

@Anthropic btw I think just changing the npm test script to "webpack && karma start karma.conf.js --log-level debug --single-run" would be enough to run the travis tests properly.

@Anthropic
Copy link
Member

@mnzaki cheers, updated locally, will push on the weekend :)

mnzaki added a commit to mnzaki/angular-schema-form that referenced this pull request Jun 13, 2017
dev-arrow added a commit to dev-arrow/angular-schema-form that referenced this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants