Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fork of markdown-it-imsize
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Postal Owl
Fork of markdown-it-imsize
Commits
1c084937
Commit
1c084937
authored
10 years ago
by
tatsy
Browse files
Options
Downloads
Patches
Plain Diff
Add unit tests for improve the coverage.
parent
644bdc4a
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
Makefile
+1
-0
1 addition, 0 deletions
Makefile
bower.json
+1
-1
1 addition, 1 deletion
bower.json
lib/imsize/index.js
+1
-1
1 addition, 1 deletion
lib/imsize/index.js
package.json
+1
-0
1 addition, 0 deletions
package.json
test/test.js
+18
-2
18 additions, 2 deletions
test/test.js
with
22 additions
and
4 deletions
Makefile
+
1
−
0
View file @
1c084937
...
...
@@ -8,6 +8,7 @@ lint:
publish
:
webpack ./
uglifyjs dist/markdown-it-imsize.js
>
dist/markdown-it-imsize.min.js
bower register markdown-it-imsize https://github.com/tatsy/markdown-it-imsize.git
test
:
lint
mocha
...
...
This diff is collapsed.
Click to expand it.
bower.json
+
1
−
1
View file @
1c084937
...
...
@@ -18,6 +18,6 @@
"test"
,
"helpers"
,
"Makefile"
,
"
index*
"
"
lib
"
]
}
This diff is collapsed.
Click to expand it.
lib/imsize/index.js
+
1
−
1
View file @
1c084937
...
...
@@ -28,7 +28,7 @@ function lookup(buffer, filepath) {
}
function
asyncFileToBuffer
(
filepath
,
callback
)
{
fs
.
o
e
pn
(
filepath
,
'
r
'
,
function
(
err0
,
descriptor
)
{
fs
.
op
e
n
(
filepath
,
'
r
'
,
function
(
err0
,
descriptor
)
{
if
(
err0
)
{
return
callback
(
err0
);
}
...
...
This diff is collapsed.
Click to expand it.
package.json
+
1
−
0
View file @
1c084937
...
...
@@ -29,6 +29,7 @@
"
markdown-it
"
:
"
^3.0.4
"
,
"
markdown-it-testgen
"
:
"
^0.1.4
"
,
"
mocha
"
:
"
^2.1.0
"
,
"
should
"
:
"
^5.0.0
"
,
"
uglify-js
"
:
"
^2.4.16
"
,
"
webpack
"
:
"
^1.5.3
"
}
...
...
This diff is collapsed.
Click to expand it.
test/test.js
+
18
−
2
View file @
1c084937
...
...
@@ -3,6 +3,7 @@
var
assert
=
require
(
'
assert
'
);
var
path
=
require
(
'
path
'
);
var
generate
=
require
(
'
markdown-it-testgen
'
);
var
should
=
require
(
'
should
'
);
describe
(
'
markdown-it-imsize
'
,
function
()
{
var
md
=
require
(
'
markdown-it
'
)({
...
...
@@ -23,9 +24,10 @@ describe('markdown-it-imsize (autofill)', function() {
});
describe
(
'
image size detector
'
,
function
()
{
it
(
'
image size detector
'
,
function
(
done
)
{
var
imsize
=
require
(
'
../lib/imsize
'
);
var
types
=
require
(
'
../lib/imsize/types
'
);
it
(
'
image size detector
'
,
function
(
done
)
{
types
.
forEach
(
function
(
type
)
{
var
dim
=
imsize
(
'
./test/img/lena.
'
+
type
);
assert
.
equal
(
dim
.
width
,
128
);
...
...
@@ -33,4 +35,18 @@ describe('image size detector', function() {
});
done
();
});
it
(
'
imsize detector anync
'
,
function
()
{
types
.
forEach
(
function
(
type
)
{
imsize
(
'
./test/img/lena.
'
+
type
,
function
(
err
,
dim
)
{
assert
.
equal
(
dim
.
width
,
128
);
assert
.
equal
(
dim
.
height
,
128
);
});
});
});
it
(
'
invalid operation
'
,
function
(
done
)
{
(
function
()
{
imsize
(
'
./test/img/lena.svg
'
)
}).
should
.
throw
();
done
();
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment