Skip to content

Commit

Permalink
Add test for inikulin#318
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinjuarez committed Jun 24, 2020
1 parent 8f36430 commit 2e33574
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/parse5/test/location-info-parser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,19 @@ exports['Updating node source code location (GH-314)'] = function() {
end: { line: 1, column: 33, offset: 32 }
});
};

exports['Tree adapter: htmlparser2 - Regression - SVG camel case attr location lookup (GH-318)'] = function() {
const treeAdapter = treeAdapters.default;
const document = parse5.parseFragment('<svg onClick="onClick();" viewBox="0 0 100 100"></svg>', {
treeAdapter,
sourceCodeLocationInfo: true
});
const svg = document.childNodes[0];
const attributeLocations = svg.sourceCodeLocation.attrs;

svg.attrs.forEach(attr => {
const name = attr.prefix ? `${attr.prefix}:${attr.name}` : attr.name;

assert.strictEqual(name in attributeLocations, true);
});
};

0 comments on commit 2e33574

Please sign in to comment.