Coder Social home page Coder Social logo

Comments (5)

jasonmit avatar jasonmit commented on May 21, 2024

Unit testing may be a problem, acceptance shouldn't be.

I'll think of a way to best solve this, perhaps by creating a utility function you would need to invoke in the setup hook of your unit test. Would that be acceptable?

It would be responsible for registering all the helpers and passing in a configuration for your locale settings.

from ember-intl.

terryroe avatar terryroe commented on May 21, 2024

The above problems I ran into were in unit tests for components. It would be nice if there were a better way to stub things out, but I can live with my approach for now. A utility function for setup would be great. Thanks.

from ember-intl.

jasonmit avatar jasonmit commented on May 21, 2024

With my latest changes (1.1.0), it's a little bit easier. Assuming you are on Ember 1.10 (if 1.9, use Ember.Handlebars.registerHelper:
https://github.com/yahoo/ember-intl/blob/master/tests/unit/format-date-test.js#L13-L14

You'll also want to register an intl:main into the Container.

import Intl from 'app/services/intl';

// in your setup
container.register('intl:main", Intl, { instantiate: true, singleton: true });

from ember-intl.

jasonmit avatar jasonmit commented on May 21, 2024

#77 will resolve this. Feel free to test the branch out and follow the changeset in the new README.

Let me know if I should expand on anything further.

from ember-intl.

jasonmit avatar jasonmit commented on May 21, 2024

1.3.0 released today, which resolves some testing concerns.

Also, here is a pretty simple example test app seeing if a component including format-message rendered: https://github.com/jasonmit/ember-intl-1.3.0-test-example

from ember-intl.

Related Issues (20)

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.