Skip to content

Commit 2b5e6f2

Browse files
committed
Merge pull request esamattis#45 from iangreenleaf/master
Fix standalone mode
2 parents 582ed0d + c627b40 commit 2b5e6f2

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

lib/underscore.string.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
(function(root){
1111
'use strict';
1212

13-
if (typeof _() != 'undefined') {
13+
if (typeof _ != 'undefined') {
1414
var _reverse = _().reverse,
1515
_include = _.include;
1616
}

test/strings_standalone.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
$(document).ready(function() {
2+
3+
module("String extensions");
4+
5+
test("underscore not included", function() {
6+
raises(function() { _("foo") }, /TypeError/);
7+
});
8+
9+
test("provides standalone functions", function() {
10+
equals(typeof _.trim, "function");
11+
});
12+
});

test/test_standalone.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<title>Underscore.strings Test Suite</title>
5+
<link rel="stylesheet" href="https://github.com/jquery/qunit/raw/master/qunit/qunit.css" type="text/css" media="screen" />
6+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
7+
<script type="text/javascript" src="https://github.com/jquery/qunit/raw/master/qunit/qunit.js"></script>
8+
<script type="text/javascript" src="../lib/underscore.string.js"></script>
9+
<script type="text/javascript" src="strings_standalone.js"></script>
10+
11+
</head>
12+
<body>
13+
<h1 id="qunit-header">Underscore.string Test Suite</h1>
14+
<h2 id="qunit-banner"></h2>
15+
<h2 id="qunit-userAgent"></h2>
16+
<ol id="qunit-tests"></ol>
17+
</body>
18+
</html>

0 commit comments

Comments
 (0)