argument icon indicating copy to clipboard operation
argument copied to clipboard

Support data-* attributes

Open zeppelin opened this issue 7 years ago • 3 comments

zeppelin avatar Jun 08 '18 19:06 zeppelin

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 avatar Jun 08 '18 19:06 pzuraq

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)

pzuraq avatar Jun 08 '18 19:06 pzuraq

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.

alexlafroscia avatar Dec 27 '18 05:12 alexlafroscia