jaykz52 / mechanic

A CSS-style selector engine for iOS UIAutomation

Home Page:www.cozykozy.com/mechanicjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

predicate() should support key/value map to filter selection

jaykz52 opened this issue · comments

The predicate function should accept either a string or an object literal.

For example, when a string is passed into predicate, internally the withPredicate function should be used:

$('button').withPredicate('name == 'Awesome Button');

// Internally, this will collect (map) el.withPredicate('name == 'Awesome Button') 

When an object literal is passed to the predicate function, the selector should be filtered down using each key/value pair:

$('button').withPredicate({
  name: 'Awesome Button',
  someProperty: 'Some value'
});

// Internally, this will collect (map) the intersect of el.withValueForKey(value, key) for each key