✨ Added support for xml:lang attribute in SVG tag
This commit is contained in:
parent
1a029b7ac3
commit
0a1d96ea22
5 changed files with 53 additions and 16 deletions
53
tests/fixtures/render.js
vendored
53
tests/fixtures/render.js
vendored
|
@ -6,7 +6,36 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="0mm" height="0mm" viewBox="0 0 0 0"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="0mm" height="0mm" viewBox="0 0 0 0"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
]]>
|
||||
</style>
|
||||
<script type="text/javascript"> <![CDATA[
|
||||
|
||||
]]>
|
||||
</script>
|
||||
<defs>
|
||||
|
||||
</defs>
|
||||
|
||||
|
||||
<!-- Start of group #fs-container -->
|
||||
<g id="fs-container">
|
||||
</g>
|
||||
<!-- end of group #fs-container -->
|
||||
</svg>
|
||||
|
||||
<!--
|
||||
|
||||
-->`,
|
||||
boilerplateNl: `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
|
||||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="nl" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="0mm" height="0mm" viewBox="0 0 0 0"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
@ -35,7 +64,7 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" viewBox="0 0 0 0"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" viewBox="0 0 0 0"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
@ -64,7 +93,7 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="20mm" height="20mm" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="20mm" height="20mm" viewBox="0 0 20 20"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
@ -98,7 +127,7 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="60mm" height="72.45mm" viewBox="0 0 60 72.45"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="60mm" height="72.45mm" viewBox="0 0 60 72.45"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
@ -133,7 +162,7 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="20mm" height="20mm" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="20mm" height="20mm" viewBox="0 0 20 20"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
@ -169,7 +198,7 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="120mm" height="120mm" viewBox="0 0 120 120"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="120mm" height="120mm" viewBox="0 0 120 120"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
@ -208,7 +237,7 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="20mm" height="20mm" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="20mm" height="20mm" viewBox="0 0 20 20"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
@ -244,7 +273,7 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="20mm" height="20mm" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="20mm" height="20mm" viewBox="0 0 20 20"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
@ -280,7 +309,7 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="60mm" height="72.45mm" viewBox="0 0 60 72.45"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="60mm" height="72.45mm" viewBox="0 0 60 72.45"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
@ -317,7 +346,7 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="60mm" height="72.45mm" viewBox="0 0 60 72.45"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="60mm" height="72.45mm" viewBox="0 0 60 72.45"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
@ -354,7 +383,7 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="60mm" height="72.45mm" viewBox="0 0 60 72.45"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="60mm" height="72.45mm" viewBox="0 0 60 72.45"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
@ -391,7 +420,7 @@ var render = {
|
|||
<!--
|
||||
|
||||
--><svg
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="20mm" height="20mm" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" xmlns:freesewing="http://freesewing.org/namespaces/freesewing" freesewing="${version}" width="20mm" height="20mm" viewBox="0 0 20 20"
|
||||
>
|
||||
<style type="text/css"> <![CDATA[
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ it("Pattern constructor should initialize object", () => {
|
|||
expect(pattern.height).to.equal(false);
|
||||
expect(pattern.settings.mode).to.equal("draft");
|
||||
expect(pattern.parts).to.eql({});
|
||||
expect(pattern.config.units).to.equal("metric");
|
||||
expect(pattern.settings.units).to.equal("metric");
|
||||
expect(pattern.config.foo).to.equal("bar");
|
||||
expect(pattern.options.constant).to.equal(2);
|
||||
expect(pattern.options.percentage).to.equal(0.3);
|
||||
|
|
|
@ -39,6 +39,12 @@ it("Should render Svg boilerplate", () => {
|
|||
expect(pattern.render()).to.equalIgnoreSpaces(render.boilerplate);
|
||||
});
|
||||
|
||||
it("Should render language attribute", () => {
|
||||
let pattern = new freesewing.Pattern();
|
||||
pattern.settings.locale = "nl";
|
||||
expect(pattern.render()).to.equalIgnoreSpaces(render.boilerplateNl);
|
||||
});
|
||||
|
||||
it("Should render Svg boilerplate for embedding", () => {
|
||||
let pattern = new freesewing.Pattern();
|
||||
pattern.settings.embed = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue