-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
36 additions
and
2 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
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
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,23 @@ | ||
'use strict'; | ||
|
||
var test = require('tape'); | ||
var u = require('unist-builder'); | ||
var to = require('..'); | ||
var all = require('../lib/all'); | ||
|
||
test('handlers option', function (t) { | ||
var handlers = { | ||
paragraph: function (h, node) { | ||
node.children[0].value = 'changed'; | ||
return h(node, 'p', all(h, node)); | ||
} | ||
}; | ||
|
||
t.deepEqual( | ||
to(u('paragraph', [u('text', 'bravo')]), {handlers: handlers}), | ||
u('element', {tagName: 'p', properties: {}}, [u('text', 'changed')]), | ||
'should override default handler' | ||
); | ||
|
||
t.end(); | ||
}); |
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