Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from SpatialDNA/master
mapfish-print-component
- Loading branch information
Showing
13 changed files
with
376 additions
and
1,696 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
1 change: 1 addition & 0 deletions
1
src/sidebar/components/tools/print/printRequest/__tests__/testXML.xml
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 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note> |
47 changes: 47 additions & 0 deletions
47
src/sidebar/components/tools/print/printRequest/__tests__/utilTest.test.js
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,47 @@ | ||
import utils from "../utils"; | ||
import fs from "fs"; | ||
|
||
let xml_string = fs.readFileSync(__dirname +"/testXML.xml", "utf8"); | ||
let parser = new DOMParser(); | ||
let xml = parser.parseFromString(xml_string, "text/xml"); | ||
|
||
test('converts rgb', () => { | ||
expect(utils.rgbToHex(91, 91, 91, 1)).toBe("#5b5b5b"); | ||
}); | ||
|
||
test('converts string to hash color', () => { | ||
expect(utils.stringToColour("greenish")).toBe("#9bc63b"); | ||
}); | ||
|
||
test('converts xml to json data', () => { | ||
expect(utils.xmlToJson(xml)).toEqual({ | ||
"note": { | ||
"body": { | ||
"#text": "Don't forget me this weekend!" | ||
}, | ||
"from": { | ||
"#text": "Jani" | ||
}, | ||
"heading": { | ||
"#text": "Reminder" | ||
}, | ||
"to": { | ||
"#text": "Tove" | ||
} | ||
} | ||
}); | ||
}); | ||
|
||
test('remove null and undefined values from object', () => { | ||
expect(utils.removeNull({ | ||
a: null, | ||
b: 1, | ||
c: undefined | ||
})).toEqual({ | ||
b: 1 | ||
}); | ||
}); | ||
|
||
test('Extracts Service name from url', () => { | ||
expect(utils.extractServiceName("https://ws.giscache.lrc.gov.on.ca/arcgis/rest/services/LIO_Cartographic/LIO_Topographic/MapServer")).toBe("LIO_Cartographic_LIO_Topographic"); | ||
}); |
30 changes: 0 additions & 30 deletions
30
src/sidebar/components/tools/print/printRequest/_test_/printTest.js
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
src/sidebar/components/tools/print/printRequest/_test_/utilTest.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.