Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix toImage bug and split tests based on browser requirement #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/caman.full.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function(config) {
'test/ext/test-loader.js',
'test/ext/grey.js',
'dist/caman.full.js',
'test/unit/*.coffee',
'test/unit/**/*.coffee',
{pattern: 'test/ext/grey.png', watched: false, included: false}
],

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
"karma-mocha": "*"
},
"scripts": {
"test": "./node_modules/mocha/bin/mocha --compilers coffee:coffee-script --reporter spec --globals Caman ./test/unit/*.coffee && ./node_modules/.bin/karma start --single-run --browsers Firefox",
"test": "./node_modules/mocha/bin/mocha --compilers coffee:coffee-script/register --reporter spec --globals Caman ./test/unit/*.coffee && ./node_modules/.bin/karma start --single-run --browsers Firefox",
"test-local": "./node_modules/mocha/bin/mocha --compilers coffee:coffee-script/register --reporter spec --globals Caman ./test/unit/*.coffee",
"test-browser": "./node_modules/.bin/karma start --single-run --browsers Firefox",
"examples": "./node_modules/servedir/bin/servedir",
"docs": "codo",
"docs-server": "codo --server"
Expand Down
17 changes: 17 additions & 0 deletions test/unit/browser/io.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if exports?
{Caman} = require "../../dist/caman.full"
{assert} = require 'chai'
{greyImage, greyPath, rgbData} = require '../ext/grey'

describe "io", ->
it "should generate image tag", (done) ->
Caman greyImage, ->
img = @toImage()
assert img.src && img.src.match(/^data:image\/png;base64/)
done()

it "should generate base64 data url", (done) ->
Caman greyImage, ->
dataURL = @toBase64()
assert dataURL.match(/^data:image\/png;base64/)
done()