-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(parser) Add hljs.registerAlias() public API (#2540)
* Add hljs.registerAlias(alias, languageName) public API * Add .registerAlias() test
- Loading branch information
1 parent
5c125b9
commit 2fafd0e
Showing
4 changed files
with
51 additions
and
10 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,24 @@ | ||
'use strict'; | ||
|
||
const hljs = require('../../build'); | ||
const should = require('should'); | ||
|
||
describe('.registerAlias()', () => { | ||
it('should get an existing language by alias', () => { | ||
hljs.registerAlias('jquery', { | ||
languageName: 'javascript' | ||
}); | ||
const result = hljs.getLanguage('jquery'); | ||
|
||
result.should.be.instanceOf(Object); | ||
}); | ||
|
||
it('should get an existing language by aliases', () => { | ||
hljs.registerAlias(['jquery', 'jqueryui'], { | ||
languageName: 'javascript' | ||
}); | ||
const result = hljs.getLanguage('jquery'); | ||
|
||
result.should.be.instanceOf(Object); | ||
}); | ||
}); |