queryCompound.js 788 B

1234567891011121314151617181920212223242526272829
  1. define([
  2. "esquery",
  3. "jstestr/assert",
  4. "jstestr/test",
  5. "./fixtures/conditional",
  6. "./fixtures/forLoop",
  7. "./fixtures/simpleFunction",
  8. "./fixtures/simpleProgram"
  9. ], function (esquery, assert, test, conditional, forLoop, simpleFunction, simpleProgram) {
  10. test.defineSuite("Compound query", {
  11. "two attributes": function () {
  12. var matches = esquery(conditional, '[left.name="x"][right.value=1]');
  13. assert.contains([
  14. conditional.body[0].test
  15. ], matches);
  16. },
  17. "type and pseudo": function () {
  18. var matches = esquery(conditional, '[left.name="x"]:matches(*)');
  19. assert.contains([
  20. conditional.body[0].test
  21. ], matches);
  22. }
  23. });
  24. });