Giter Site home page Giter Site logo

ember-fit-form's People

Contributors

dependabot-preview[bot] avatar ember-tomster avatar flexyford avatar jfdnc avatar steveszc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jfdnc steveszc

ember-fit-form's Issues

Unusable in apps using Pods file layout with a pod module prefix

According to the ember guides https://cli.emberjs.com/release/advanced-use/project-layouts/

Addons should only use the classic structure for compatibility with either classic or pods-based consuming applications.

ember-fit-form has it's main fit-form component strucutred as a pod, rather than the classic layout. Any consuming app that uses a pod-module-prefix will be unable to resolve the fit-form component.

Suggested Fix:

addon
├── components/fit-form
     ├── template.hbs
     └── component.js

should become

addon
├── components
|   └── fit-form.js
├── templates
    └── components/fit-form.hbs

Configure `adapterName` from config

The adapterName should be configurable from the config file. It will still default to ember-changeset and be configurable from the component invocation level.

Build failing

The build is failing due to a test that is failing.

Unit | Component | form-adapters/ember-changeset/ember-changeset-validations > with a model with validations > validate the form: validating an invalid form fails the validation step
---
        actual: >
            false
        expected: >
            true
        message: >
            oninvalid was called

This appears to be due to this change in ember-changeset poteto/ember-changeset#378

It seems like something changed around how promises are handled within validations, and either the tests or the implementation for the ember-changeset adapter are not handling those validation promises correctly.

My best guess is that our base adapter's validate method is not itself promise aware, so when the test awaits the form validate there is no promise to await and the test finishes before the async validation code finishes and has a chance to call the oninvalid method.
https://github.com/truecoach/ember-fit-form/blob/master/addon/form-adapters/base.js#L47
https://github.com/truecoach/ember-fit-form/blob/master/tests/unit/components/form-adapters/ember-changeset-test.js#L149

Trouble Integration Testing

Consuming applications and addons do not benefit from the application initializer when running integration tests. We need an easy to use solution for consuming apps to test with ember-fit-form

Replace "cancel" with "reset"

The default behavior for form.cancel() is similar to the HTMLFormElement.reset() method which restores a form element's default values.

The reset event fires when a <form> is reset. The reset() method resets the values of all elements in a form (same as clicking the Reset button).

This allows us to handle the reset event the same way we handle submit event, without relying on custom cancel logic and handlers

<button type="reset">Cancel</button>
<button type="submit">Submit</button>
reset(event) {
  event.preventDefault();
  this.get('formObject').reset(...arguments);
},
submit(event) {
  event.preventDefault();
  this.get('formObject').submit(...arguments);
},

Default form-adapter

The default form-adapter should be the base adapter.

This ensures that all addon users update their default adapter in the config file.

Document default event handlers

Each form-adapter has default onevent actions which can be overridden at component invocation. Let's document the default behavior for each adapter. This will also help guide the "Custom Adapter" section when we're ready to add that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.