11// LICENSE : MIT
22"use strict" ;
33import assert from "power-assert" ;
4- import HTMLProcessor from "../src/HTMLProcessor" ;
4+ import HTMLPlugin from "../src/index"
55import { parse } from "../src/html-to-ast" ;
66import { tagNameToType } from "../src/mapping" ;
77import { TextLintCore } from "textlint" ;
@@ -60,8 +60,8 @@ describe("HTMLProcessor-test", function () {
6060 context ( "when target file is a HTML" , function ( ) {
6161 beforeEach ( function ( ) {
6262 textlint = new TextLintCore ( ) ;
63- textlint . setupProcessors ( {
64- HTMLProcessor : HTMLProcessor
63+ textlint . setupPlugins ( {
64+ html : HTMLPlugin
6565 } ) ;
6666 textlint . setupRules ( {
6767 "no-todo" : require ( "textlint-rule-no-todo" )
@@ -78,8 +78,8 @@ describe("HTMLProcessor-test", function () {
7878 context ( "support file extensions" , function ( ) {
7979 beforeEach ( function ( ) {
8080 textlint = new TextLintCore ( ) ;
81- textlint . setupProcessors ( {
82- HTMLProcessor : HTMLProcessor
81+ textlint . setupPlugins ( {
82+ html : HTMLPlugin
8383 } ) ;
8484 textlint . setupRules ( {
8585 "no-todo" : require ( "textlint-rule-no-todo" )
@@ -99,5 +99,29 @@ describe("HTMLProcessor-test", function () {
9999 return Promise . all ( promises ) ;
100100 } ) ;
101101 } ) ;
102+ context ( "when extensions option is specified" , function ( ) {
103+ beforeEach ( function ( ) {
104+ textlint = new TextLintCore ( ) ;
105+ textlint . setupPlugins (
106+ { html : HTMLPlugin } ,
107+ { html : { extensions : [ ".custom" ] } }
108+ ) ;
109+ textlint . setupRules ( {
110+ "no-todo" : require ( "textlint-rule-no-todo" )
111+ } ) ;
112+ } ) ;
113+ it ( "should report error" , function ( ) {
114+ const fixturePathList = [
115+ path . join ( __dirname , "/fixtures/test.custom" )
116+ ] ;
117+ const promises = fixturePathList . map ( ( filePath ) => {
118+ return textlint . lintFile ( filePath ) . then ( results => {
119+ assert ( results . messages . length > 0 ) ;
120+ assert ( results . filePath === filePath ) ;
121+ } ) ;
122+ } ) ;
123+ return Promise . all ( promises ) ;
124+ } ) ;
125+ } ) ;
102126 } ) ;
103127} ) ;
0 commit comments