ember-decorators / argument

Decorators for Component and Object arguments in Ember
MIT License
30 stars 18 forks source link

Support data-* attributes #68

Open zeppelin opened 6 years ago

pzuraq commented 6 years ago

Unfortunately we can’t support anything dasherized until dynamic class fields are figured out and standardized. In the meantime, you can bind attributes using @attribute:

@argument
@attribute(‘data-foo’)
dataFoo;
pzuraq commented 6 years ago

Note that we do respect attribute and class name bindings, so addons which automatically add bindings for data- attributes should work fine (e.g. ember test selectors)

alexlafroscia commented 5 years ago

Assuming that the intention behind this issue is to allow the whitelist to be expanded to not error when giving a component a data-test-* attribute, this will be supported if/when #91 is merged. You'll be able to do something like this:

// config/environment.js
module.exports = function() {
  let ENV = {
    '@ember-decorators/argument': {
      argumentWhitelist: {
        startsWith: ['data-test']
      }
    }
  };

  return ENV;
};

and any data-test attributes will no longer throw an assertion.