posthtml-rename-attrs
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "posthtml-rename-attrs", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Rename HTML tags", | ||
@@ -9,2 +9,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"camelcase": "^4.1.0", | ||
"chai": "^4.1.2", | ||
@@ -11,0 +12,0 @@ "mocha": "^4.0.1", |
@@ -13,5 +13,3 @@ # posthtml-rename-attrs | ||
posthtml([ require('posthtml-rename-attrs')({ | ||
'.wow' : prefix | ||
})]) | ||
posthtml([ require('posthtml-rename-attrs')(prefix)]) | ||
.process(html) | ||
@@ -18,0 +16,0 @@ .then(function(result) { |
@@ -1,15 +0,16 @@ | ||
var posthtml = require('posthtml'), | ||
const posthtml = require('posthtml'), | ||
camelcase = require('camelcase'), | ||
expect = require('chai').expect, | ||
renameTags = require('..'); | ||
const prefix = v => v === 'class' ? `prefix-${v}` : v; | ||
const camelize = name => camelcase(name); | ||
describe('Plugin', function() { | ||
it('should process simple class selectors', function() { | ||
var html = '<div class="wow">OMG</div>'; | ||
it('should process', function() { | ||
var html = '<div prefix-class="wow">OMG</div>'; | ||
return pluginProcess(prefix, html) | ||
return pluginProcess(camelize, html) | ||
.then(function(html) { | ||
expect(html).to.eql('<div prefix-class="wow">OMG</div>'); | ||
expect(html).to.eql('<div prefixClass="wow">OMG</div>'); | ||
}); | ||
@@ -19,3 +20,3 @@ }); | ||
it('should process tag selectors and skip empty attrs', function () { | ||
it('should skip empty attrs', function () { | ||
var html = '<div>OMG</div><p>block</p><div>OMG2</div>', | ||
@@ -25,3 +26,3 @@ expectedHtml = '<div>OMG</div><p>block</p>' + | ||
return pluginProcess(prefix, html) | ||
return pluginProcess(camelize, html) | ||
.then(function(html) { | ||
@@ -31,13 +32,2 @@ expect(html).to.eql(expectedHtml); | ||
}); | ||
it('should process other match helper and skip non class attrs', function () { | ||
var html = '<div id="id">OMG</div><p id="wow">block</p><div>OMG2</div>', | ||
expectedHtml = '<div id="id">OMG</div><p id="wow">block</p>' + | ||
'<div>OMG2</div>'; | ||
return pluginProcess(prefix, html) | ||
.then(function(html) { | ||
expect(html).to.eql(expectedHtml); | ||
}); | ||
}); | ||
}); | ||
@@ -44,0 +34,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2627
4
45
21