-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// @flow | ||
|
||
import test from 'ava'; | ||
import { | ||
NotFoundError | ||
} from '../../src'; | ||
import getAttributeSelector from '../../src/utilities/getAttributeSelector'; | ||
|
||
test('returns the attribute selector', (t): void => { | ||
t.deepEqual(getAttributeSelector('a@href'), { | ||
attributeName: 'href', | ||
expression: '@href' | ||
}); | ||
}); | ||
|
||
test('throws an error if the attribute selector is not present', (t): void => { | ||
t.throws(() => { | ||
getAttributeSelector('a'); | ||
}, NotFoundError); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// @flow | ||
|
||
import test from 'ava'; | ||
import { | ||
NotFoundError | ||
} from '../../src'; | ||
import getPropertySelector from '../../src/utilities/getPropertySelector'; | ||
|
||
test('returns the property selector', (t): void => { | ||
t.deepEqual(getPropertySelector('a@.textContent'), { | ||
expression: '@.textContent', | ||
propertyName: 'textContent' | ||
}); | ||
}); | ||
|
||
test('throws an error if the property selector is not present', (t): void => { | ||
t.throws(() => { | ||
getPropertySelector('a'); | ||
}, NotFoundError); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// @flow | ||
|
||
import test from 'ava'; | ||
import hasAttributeSelector from '../../src/utilities/hasAttributeSelector'; | ||
|
||
test('returns true if the attribute selector is present', (t): void => { | ||
t.true(hasAttributeSelector('a@href') === true); | ||
}); | ||
|
||
test('returns false if the attribute selector is not present', (t): void => { | ||
t.true(hasAttributeSelector('a') === false); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// @flow | ||
|
||
import test from 'ava'; | ||
import hasPropertySelector from '../../src/utilities/hasPropertySelector'; | ||
|
||
test('returns true if the property selector is present', (t): void => { | ||
t.true(hasPropertySelector('a@.href') === true); | ||
}); | ||
|
||
test('returns false if the property selector is not present', (t): void => { | ||
t.true(hasPropertySelector('a') === false); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters