ast-workshop icon indicating copy to clipboard operation
ast-workshop copied to clipboard

Solution to 05b-strip-test-selectors

Open iamdtang opened this issue 5 years ago • 0 comments

Hey @Turbo87, thanks for putting together the workshop in written form. Loving it! Do you have the solution for 05b-strip-test-selectors?

I have the following code in ember-cli-build.js, but I still see data-test-*** attributes in the DOM when I npm start, which I restarted.

class StripTestSelectorsTransform {
    transform(root) {
      this.syntax.traverse(root, {
        // TODO write your implementation here
        AttrNode(node) {
          if (node.name.startsWith('data-test-')) {
            return null;
          }
        }
      });

      return root;
    }
  }

iamdtang avatar Mar 29 '20 00:03 iamdtang