Skip to content

Commit

Permalink
add json tests
Browse files Browse the repository at this point in the history
  • Loading branch information
crabbly committed Jun 4, 2018
1 parent 99b6e2f commit 6568e37
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "print-js",
"homepage": "http://printjs.crabbly.com",
"description": "A tiny javascript library to help printing from the web.",
"version": "1.0.44",
"version": "1.0.45",
"main": "dist/print.js",
"repository": "https://github.com/crabbly/Print.js",
"license": "MIT",
Expand Down
36 changes: 36 additions & 0 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,36 @@
}

function printJson() {
let data = [
{
test1: 'Test1 string',
test2: 'Test2 string'
},
{
test1: 'more Test1 string',
test2: 'more Test2 string'
}
]

printJS({printable: data, properties: ['test1', 'test2'], type: 'json'})
}

function printStyledJson() {
let data = [
{
test1: 'Test1 string',
test2: 'Test2 string'
},
{
test1: 'more Test1 string',
test2: 'more Test2 string'
}
]

printJS({printable: data, properties: ['test1', 'test2'], type: 'json', gridStyle: 'border: 2px solid #3971A5;', gridHeaderStyle: 'color: red; border: 2px solid #3971A5;'})
}

function printNestedJson() {
let data = [
{
test1: 'Test1 string',
Expand Down Expand Up @@ -85,6 +115,12 @@ <h1>Print.js Test Page</h1>
<button onClick='printJson();'>
Print JSON
</button>
<button onClick='printStyledJson();'>
Print Styled JSON
</button>
<button onClick='printNestedJson();'>
Print Nested JSON
</button>
</p>
</section>
</body>
Expand Down

0 comments on commit 6568e37

Please sign in to comment.