Skip to content

Commit

Permalink
test for RegExp searching + docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszmarkowski committed Aug 10, 2016
1 parent 960fe11 commit 95c9f90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -386,11 +386,12 @@ You can pass either one id or an array of ids:

### .find( mixed )

Find method lets you search using *character*, seat status or a combination of both (separated with a dot):
Find method lets you search using *character*, seat status, combination of both (separated with a dot) or a regexp:

sc.find('a'); //find all a seats
sc.find('unavailable'); //find all unavailable seats
sc.find('a.available'); //find all available a seats
sc.find(/^1_[0-9]+/); //find all seats in the first row


#### .get and .find chained together:
Expand Down
6 changes: 5 additions & 1 deletion test/methods.js
Expand Up @@ -150,7 +150,7 @@
});

test('Testing .find selector', function () {
expect(14);
expect(16);

var $seatCharts = methodsMapSetup(),
seatCharts = $seatCharts.seatCharts();
Expand Down Expand Up @@ -186,6 +186,10 @@
equal(seatCharts.get(['2_1', '3_2', '5_5', '5_3', '4_2', '2_3']).find('c.invalid-status').length, 0, 'Finding in set by character and invalid status.');

equal(seatCharts.get(['9_12', '', '4_53']).find('b').length, 0, 'Finding in empty set.');

equal(seatCharts.find(/^1_.*/).length, 4, 'Finding first row seats using a regexp.');

equal(seatCharts.find(/^[0-9]+_3/).length, 4, 'Finding third column seats using a regexp.');
});

test('Testing .node method', function () {
Expand Down

0 comments on commit 95c9f90

Please sign in to comment.