Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uritemplate-js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
uritemplate-js
Commits
dd7a3854
Commit
dd7a3854
authored
Jan 26, 2013
by
fxa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test the exports to node, AMD and browsers
parent
3691704b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
test/integration/testExport.js
test/integration/testExport.js
+65
-0
No files found.
test/integration/testExport.js
0 → 100644
View file @
dd7a3854
module
.
exports
=
(
function
()
{
"
use strict
"
;
var
fs
=
require
(
'
fs
'
),
path
=
require
(
'
path
'
),
sandbox
=
require
(
'
nodeunit
'
).
utils
.
sandbox
;
function
globalUriTemplateFile
()
{
return
global
.
URI_TEMPLATE_FILE
;
}
function
globalUriTemplateFileIsMinified
()
{
return
globalUriTemplateFile
().
indexOf
(
'
-min.
'
)
>=
0
;
}
var
NOISY
=
false
;
function
log
(
text
)
{
if
(
NOISY
)
{
console
.
log
(
text
);
}
}
function
isUriTemplateFuncion
(
func
)
{
return
typeof
func
===
'
function
'
&&
(
globalUriTemplateFileIsMinified
()
||
(
func
.
name
===
'
UriTemplate
'
&&
typeof
func
.
parse
===
'
function
'
&&
typeof
func
.
prototype
.
expand
===
'
function
'
));
}
return
{
'
UriTemplate can be required
'
:
function
(
test
)
{
var
context
=
{
module
:
{}};
sandbox
(
globalUriTemplateFile
(),
context
);
test
.
ok
(
isUriTemplateFuncion
(
context
.
module
.
exports
));
test
.
done
();
},
'
UriTemplate can be defined with AMD
'
:
function
(
test
)
{
var
context
=
{
define
:
function
(
arr
,
func
)
{
test
.
ok
(
Array
.
isArray
(
arr
));
test
.
strictEqual
(
typeof
func
,
'
function
'
);
test
.
ok
(
isUriTemplateFuncion
(
func
()));
test
.
done
();
}};
sandbox
(
globalUriTemplateFile
(),
context
);
},
'
UriTemplate can be put in window of Browser
'
:
function
(
test
)
{
var
context
=
{
window
:
{}};
sandbox
(
globalUriTemplateFile
(),
context
);
test
.
ok
(
isUriTemplateFuncion
(
context
.
window
.
UriTemplate
));
test
.
done
();
},
'
UriTemplate can be loaded in global object
'
:
function
(
test
)
{
var
context
=
{
global
:
{}};
sandbox
(
globalUriTemplateFile
(),
context
);
test
.
ok
(
isUriTemplateFuncion
(
context
.
global
.
UriTemplate
));
test
.
done
();
}
}
}());
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment