Skip to content
Browse files

Use gruntlerplate https://github.com/zachleat/gruntlerplate

  • Loading branch information...
1 parent 4f5e0b9 commit 60dc6db97c1c348ec9d6b5a1d09908fa84f5fa87 @zachleat committed
View
3 .csslintrc
@@ -0,0 +1,3 @@
+{
+ "adjoining-classes": false
+}
View
17 .editorconfig
@@ -0,0 +1,17 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
+
+[grunt/**]
+indent_style = tab
+indent_size = 2
View
1 .gitattributes
@@ -0,0 +1 @@
+* text=auto
View
3 .gitignore
@@ -1 +1,4 @@
node_modules/
+temp/
+dist/
+bower_components/
View
37 .jshintrc
@@ -0,0 +1,37 @@
+{
+ "curly": true,
+ "eqeqeq": true,
+ "eqnull": true,
+ "forin": false,
+ "immed": true,
+ "indent": 2,
+ "latedef": true,
+ "noarg": true,
+ "noempty": true,
+ "nonew": true,
+ "undef": true,
+ "unused": true,
+ "strict": true,
+ "trailing": true,
+ "browser": true,
+ "devel": true,
+ "jquery": true,
+ "node": true,
+ "predef": {
+ "asyncTest": false,
+ "deepEqual": false,
+ "equal": false,
+ "expect": false,
+ "module": false,
+ "notDeepEqual": false,
+ "notEqual": false,
+ "notStrictEqual": false,
+ "ok": false,
+ "QUnit": false,
+ "raises": false,
+ "start": false,
+ "stop": false,
+ "strictEqual": false,
+ "test": false
+ }
+}
View
9 .travis.yml
@@ -1,7 +1,10 @@
language: node_js
node_js:
- - 0.10
+ - '0.10'
before_script:
- npm install -g grunt-cli
- - npm install grunt grunt-contrib-qunit
-script: grunt test -v
+ - npm install
+ - npm install bower
+ - bower install
+script: grunt -v
+
View
44 Gruntfile.js
@@ -1,13 +1,35 @@
-module.exports = function(grunt) {
- grunt.initConfig({
- qunit: {
- files: ['test/*.html']
- }
- });
-
- grunt.loadNpmTasks('grunt-contrib-qunit');
-
- // A convenient task alias.
- grunt.registerTask('test', 'qunit');
+module.exports = function( grunt ) {
+ 'use strict';
+
+ function loadConfig( path ) {
+ var glob = require( "glob" ),
+ object = {},
+ key;
+
+ glob.sync( "*", {
+ cwd: path
+ }).forEach(function( option ) {
+ key = option.replace( /\.js$/, "" );
+ if( !object.hasOwnProperty( key ) ) {
+ object[ key ] = {};
+ }
+ grunt.util._.extend( object[ key ], require( path + option ) );
+ });
+
+ return object;
+ }
+
+ var config = {
+ pkg: grunt.file.readJSON( "package.json" ),
+ banner: grunt.file.read( "grunt/banner.txt" )
+ };
+
+ grunt.util._.merge( config, loadConfig( "./grunt/config-lib/" ), loadConfig( "./grunt/config/" ) );
+
+ grunt.initConfig( config );
+
+ require( "matchdep" ).filterDev( "grunt-*" ).forEach( grunt.loadNpmTasks );
+
+ grunt.loadTasks( "grunt" );
};
View
313 LICENSE
@@ -1,305 +1,20 @@
-Copyright (c) 2011 Zach Leatherman
+Copyright 2013 Zach Leatherman
-
-MIT LICENSE
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-
-GNU GENERAL PUBLIC LICENSE
-Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
43 README.markdown → README.md
@@ -1,17 +1,19 @@
-BigText Makes Text Big
-============================
+# BigText
+
+[![Build Status](https://travis-ci.org/zachleat/bigtext.png?branch=master)](https://travis-ci.org/zachleat/bigtext)
+
+## BigText Makes Text Big
* Read the [original blog post](http://www.zachleat.com/web/bigtext-makes-text-big/)
* Play around on the [demo](http://www.zachleat.com/bigtext/)
* Watch the [video](http://www.youtube.com/watch?v=OuqB6e6NPRM)
-Requirements
-----------------------------
+## Requirements
+
1. jQuery
1. A block level parent element. BigText will force all children to be block level as well.
-Examples
-----------------------------
+## Examples
### Simple Example
@@ -137,8 +139,8 @@ Works also with `letter-spacing`, `word-spacing`, and `text-transform`.
See [Paravel's FitText plugin](http://fittextjs.com/). Curious how the two plugins compare? I've written a full [comparison between FitText and BigText](http://www.zachleat.com/web/fittext-and-bigtext/).
-Extra Features
-----------------------------
+## Extra Features
+
### Re-BigText on Resize (Responsive BigText)
BigText does not implement its own debounced resize event, to reduce duplicate code. However, it does search for existing implementations. For example, [Ben Alman's Throttle/Debounce plugin](https://github.com/cowboy/jquery-throttle-debounce) or [Louis-Remi Babe's SmartResize](https://github.com/lrbabe/jquery-smartresize/), in that order. If no debounced plugin is found, BigText will bind to the native resize event.
@@ -149,14 +151,12 @@ BigText uses an off-canvas detached node to improve performance when sizing. Set
BigText.DEBUG_MODE = true;
-Common Problems
-----------------------------
+## Common Problems
### Lines Wrapping Pre-BigText
The starting font-size must be small enough to guarantee that each individual line is not wrapping pre-BigText. If the line is too long, BigText will not size it correctly.
-Releases
-----------------------------
+## Releases
* `v0.1.0` Initial release
* `v0.1.1` Added line exempt feature.
@@ -165,7 +165,20 @@ Releases
* `v0.1.4` on `2013-08-24` Numerous bug fixes, improved accuracy, adds debug mode.
* `v0.1.5` on `2013-10-14` BigText uses all children by default (#40)
-Build Status
-----------------------------
-[![Build Status](https://travis-ci.org/zachleat/BigText.png?branch=master)](https://travis-ci.org/zachleat/BigText)
+## Using the repo
+
+Run these commands:
+
+ * `npm install`
+ * `bower install`
+
+## Configuring Grunt
+
+Rather than one giant `Gruntfile.js`, this project is using a modular Grunt setup. Each individual grunt configuration option key has its own file located in `grunt/config-lib/` (readonly upstream configs, do not modify these directly) or `grunt/config/` (project specific configs). You may use the same key in both directories, the objects are smartly combined using [Lo-Dash merge](http://lodash.com/docs#merge).
+
+For concatenation in the previous Gruntfile setup, you’d add another key to the giant object passed into `grunt.initConfig` like this: `grunt.initConfig({ concat: { /* YOUR CONFIG */ } });`. In the new configuration, you’ll create a `grunt/config/concat.js` with `module.exports = { /* YOUR CONFIG */ };`.
+
+## License
+
+[MIT License](http://en.wikipedia.org/wiki/MIT_License)
View
32 artifacts/output.html
@@ -1,32 +0,0 @@
-<!doctype html>
-<html>
-<head>
-<meta charset="utf-8"/>
-<link type="text/css" rel="stylesheet" href="css/league-gothic/stylesheet.css"/>
-<style>
-.bigtext { font-size: 11px; text-align: justify; text-justify: newspaper; }
-.bigtext { font-family: Helvetica, Arial; }
-.bigtext-line { line-height: 0.95em; }
-.bigtext { font-family: 'LeagueGothicRegular'; }
-.bigtext-line0 { font-size: 4.029999999999999em; }
-.bigtext-line1 { font-size: 6.72em; }
-.bigtext-line2 { font-size: 12.96em; }
-.bigtext-line3 { font-size: 11.05em; }
-.bigtext-line4 { font-size: 4.42em; }
-.bigtext-line5 { font-size: 3em; }
-
-</style>
-</head>
-<body>
-<div class="bigtext">
-
-<div class="bigtext-line bigtext-line0">“DON'T ASK WHAT THE WORLD NEEDS.</div>
-<div class="bigtext-line bigtext-line1 bigtext-focus">ASK WHAT MAKES YOU</div>
-<div class="bigtext-line bigtext-line2 bigtext-focus">COME ALIVE</div>
-<div class="bigtext-line bigtext-line3 bigtext-focus">AND GO DO IT.</div>
-<div class="bigtext-line bigtext-line4">BECAUSE WHAT THE WORLD NEEDS</div>
-<div class="bigtext-line bigtext-line5">IS PEOPLE WHO HAVE COME ALIVE.” — H. THURMAN</div>
-
-</div>
-</body>
-</html>
View
12 bower.json
@@ -0,0 +1,12 @@
+{
+ "name": "GRUNTLERPLATE",
+ "version": "0.0.0",
+ "main": ["dist/GRUNTLERPLATE.js"],
+ "ignore": [
+ "**/.*"
+ ],
+ "dependencies": {
+ "jquery": ">=1.9.1 <2.0.0",
+ "qunit": ">=1.12.0"
+ }
+}
View
14 demo/index.html → demo/wizard.html
@@ -16,8 +16,8 @@
</div>
</div>
<div id="toolbar">
- <div id="tabs">
- <ul>
+ <div id="tabs">
+ <ul>
<li><a href="#tabs-width">Width: <span id="posterWidth">430</span>px</a></li>
<li><a href="#tabs-css">CSS</a></li>
<li><a href="#tabs-height">Line Height</a></li>
@@ -40,16 +40,16 @@
.bigtext > div {
line-height: 0.95em;
}</textarea>
-</div>
+</div>
<div id="tabs-height">
<div id="lineHeightSliders"></div>
</div>
<div id="tabs-3d">
<form>
<div class="no-3d-transforms-support">
- <div class="ui-state-error ui-corner-all info-box">
+ <div class="ui-state-error ui-corner-all info-box">
<p>
- <span class="ui-icon ui-icon-alert"></span>
+ <span class="ui-icon ui-icon-alert"></span>
<strong>Darn.</strong> Your browser does not support 3d transforms, and the 3d stuff
here won't work for you. If you want to check it out, try Safari or a dev build of Chrome.
</p>
@@ -91,7 +91,7 @@
<script src="//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js"></script>
<script src="js/modernizr-1.6.min.js"></script>
<script src="js/jquery.ba-throttle-debounce.min.js"></script>
- <script src="../bigtext.js"></script>
+ <script src="../dist/bigtext.js"></script>
<script src="bigtextWizard.js"></script>
</body>
-</html>
+</html>
View
4 grunt/banner.txt
@@ -0,0 +1,4 @@
+/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>
+<%= pkg.homepage ? " * " + pkg.homepage : "" %>
+ * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> (@<%= pkg.author.twitter %>)
+ * <%= _.pluck( pkg.licenses, "type" ).join(", ") %> License */
View
8 grunt/config-lib/bytesize.js
@@ -0,0 +1,8 @@
+module.exports = {
+ dist: {
+ src: [
+ "<%= pkg.config.dist %>/*.js",
+ "<%= pkg.config.dist %>/*.css"
+ ]
+ }
+};
View
3 grunt/config-lib/clean.js
@@ -0,0 +1,3 @@
+module.exports = {
+ files: ["<%= pkg.config.dist %>/"]
+};
View
13 grunt/config-lib/concat.js
@@ -0,0 +1,13 @@
+module.exports = {
+ options: {
+ stripBanners: true
+ },
+ js: {
+ src: [],
+ dest: "<%= pkg.config.dist %>/<%= pkg.name %>.js"
+ },
+ jstest: {
+ src: [],
+ dest: "<%= pkg.config.dist %>/test/tests.js"
+ }
+};
View
8 grunt/config-lib/csslint.js
@@ -0,0 +1,8 @@
+module.exports = {
+ options: {
+ // Use a .csslintrc file so the same options are reused in our editor.
+ // See https://github.com/CSSLint/csslint/wiki/Rules
+ csslintrc: ".csslintrc"
+ },
+ src: [ "<%= pkg.config.src %>/**/*.css" ]
+};
View
4 grunt/config-lib/gh-pages.js
@@ -0,0 +1,4 @@
+module.exports = {
+ options: {},
+ src: ["<%= pkg.config.dist %>/**/*", "<%= pkg.config.test %>/**/*", "<%= pkg.config.demo %>/**/*", "<%= pkg.config.bower %>/**/*"]
+};
View
7 grunt/config-lib/jshint.js
@@ -0,0 +1,7 @@
+module.exports = {
+ options: {
+ // Use a .jshintrc file so the same options are reused in our editor.
+ jshintrc: ".jshintrc"
+ },
+ src: [ "Gruntfile.js", "<%= pkg.config.src %>/**/*.js" ]
+};
View
13 grunt/config-lib/lintspaces.js
@@ -0,0 +1,13 @@
+module.exports = {
+ all: {
+ src: [
+ '<%= pkg.config.src %>/**/*.js',
+ '<%= pkg.config.src %>/**/*.css',
+ '<%= pkg.config.grunt %>/**/*.js',
+ '<%= pkg.config.grunt %>/**/*.css'
+ ],
+ options: {
+ editorconfig: '.editorconfig'
+ }
+ }
+};
View
7 grunt/config-lib/mkdir.js
@@ -0,0 +1,7 @@
+module.exports = {
+ init: {
+ options: {
+ create: [ "<%= pkg.config.src %>", "<%= pkg.config.demo %>" ]
+ }
+ }
+};
View
3 grunt/config-lib/qunit.js
@@ -0,0 +1,3 @@
+module.exports = {
+ all: ["<%= pkg.config.test %>/**/*.html"]
+};
View
11 grunt/config-lib/usebanner.js
@@ -0,0 +1,11 @@
+module.exports = {
+ dist: {
+ options: {
+ position: "top",
+ banner: "<%= banner %>"
+ },
+ files: {
+ src: [ "<%= pkg.config.dist %>/*.js", "<%= pkg.config.dist %>/*.css" ]
+ }
+ }
+};
View
4 grunt/config-lib/watch.js
@@ -0,0 +1,4 @@
+module.exports = {
+ files: [ "<%= pkg.config.src %>/**/*" ],
+ tasks: [ "src", "test" ]
+};
View
8 grunt/config/concat.js
@@ -0,0 +1,8 @@
+module.exports = {
+ js: {
+ src: ["src/bigtext.js"]
+ },
+ jstest: {
+ src: ["src/bigtext-test.js"]
+ }
+};
View
14 grunt/tasks.js
@@ -0,0 +1,14 @@
+module.exports = function(grunt) {
+ "use strict";
+
+ grunt.registerTask( "init", [ "mkdir" ] );
+
+ grunt.registerTask( "default", [ "clean", "lint", "src", "test", "bytesize" ] );
+
+ grunt.registerTask( "lint", [ "csslint", "jshint", "lintspaces" ] );
+ grunt.registerTask( "src", [ "lint", "concat", "usebanner" ] );
+ grunt.registerTask( "test", [ "qunit" ] );
+
+ grunt.registerTask( "deploy", [ "default", "gh-pages" ] );
+
+};
View
60 package.json
@@ -1,20 +1,52 @@
{
"name": "bigtext",
"title": "BigText",
- "description": "Calculates the font-size and word-spacing needed to match a line of text to a specific width. (jQuery plugin)",
"version": "0.1.5",
- "homepage": "https://github.com/zachleat/BigText",
+ "description": "Calculates the font-size and word-spacing needed to match a line of text to a specific width. (jQuery plugin)",
+ "keywords": [
+ "grunt",
+ "typography"
+ ],
+ "homepage": "https://github.com/zachleat/bigtext",
+ "bugs": "https://github.com/zachleat/bigtext/issues",
"author": {
- "name": "zachleat",
+ "name": "Zach Leatherman",
"email": "zachleatherman@gmail.com",
- "url": "http://www.zachleat.com/"
+ "twitter": "zachleat",
+ "github": "zachleat",
+ "url": "http://zachleat.com"
},
"repository": {
"type": "git",
- "url": "git://github.com/zachleat/BigText.git"
+ "url": "git://github.com/zachleat/bigtext.git"
+ },
+ "scripts": {
+ "test": "grunt test"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "grunt": "~0.4.4",
+ "grunt-contrib-jshint": "~0.10.0",
+ "glob": "~3.2.9",
+ "load-grunt-tasks": "~0.4.0",
+ "matchdep": "~0.3.0",
+ "grunt-contrib-clean": "~0.5.0",
+ "grunt-contrib-qunit": "~0.4.0",
+ "grunt-contrib-watch": "~0.6.1",
+ "grunt-gh-pages": "~0.9.1",
+ "grunt-contrib-concat": "~0.4.0",
+ "bytesize": "~0.2.0",
+ "grunt-bytesize": "~0.1.1",
+ "grunt-contrib-csslint": "~0.2.0",
+ "grunt-banner": "~0.2.2",
+ "grunt-replace": "~0.7.6",
+ "grunt-lintspaces": "~0.5.0",
+ "grunt-mkdir": "~0.1.1"
},
- "bugs": {
- "url": "https://github.com/zachleat/BigText/issues"
+ "peerDependencies": {},
+ "engines": {
+ "node": ">=0.8.0",
+ "npm": ">=1.2.10"
},
"licenses": [
{
@@ -22,10 +54,12 @@
"url": "https://github.com/zachleat/BigText/blob/master/LICENSE"
}
],
- "devDependencies": {
- "grunt": "~0.4.1",
- "grunt-contrib-qunit": "~0.2.2"
- },
- "dependencies": {},
- "keywords": []
+ "config": {
+ "grunt": "grunt",
+ "src": "src",
+ "dist": "dist",
+ "test": "test",
+ "demo": "demo",
+ "bower": "bower_components"
+ }
}
View
320 src/bigtext-test.js
@@ -0,0 +1,320 @@
+/* global BigText:true */
+(function( w, $ ) {
+ "use strict";
+
+ var BigTextTest = {},
+ ua = navigator.userAgent,
+ ie = (function(){
+
+ var undef,
+ v = 3,
+ div = document.createElement('div'),
+ all = div.getElementsByTagName('i');
+
+ while (
+ div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
+ all[0]
+ ) {
+ continue;
+ }
+
+ return v > 4 ? v : undef;
+ }());
+
+ // Be a little bit more forgiving on IE8 and Travis-CI/Ubuntu + PhantomJS
+ if( ie && ie <= 8 ||
+ ua.indexOf( 'PhantomJS' ) > -1 && ua.indexOf( 'Linux' ) > -1 ) {
+
+ BigTextTest.tolerance = 14;
+ } else {
+ BigTextTest.tolerance = 10;
+ }
+
+ // If the lines of text are blocks, testing their width will tell us nothing.
+ BigTextTest.init = function()
+ {
+ return this.css('float', 'left');
+ };
+
+ BigTextTest.linesTest = function(selector, expectedWidth, options)
+ {
+ options = $.extend( options, {} );
+
+ var tolerance = BigTextTest.tolerance,
+ minWidth = expectedWidth - tolerance,
+ maxWidth = expectedWidth + tolerance,
+ $test = $(selector),
+ $lines = options.childSelector ? $test.find( options.childSelector ) : $test.children(),
+ startingFontSize = parseInt($lines.eq(0).css('font-size'), 10);
+
+ BigTextTest.init.call($lines);
+
+ $lines.each(function(j)
+ {
+ var width = $(this).width();
+ ok(!(( minWidth < width ) && ( width < maxWidth )), 'Pretest: Line ' + j + ' should not be max width (' + minWidth + ' < ' + width + ' < ' + maxWidth + ', font-size: ' + $(this).css('font-size') + ')');
+ });
+
+ $test.bigtext(options);
+
+ ok('Class added.', $test.is('.bigtext'));
+
+ $lines.each(function(j)
+ {
+ var $t = $(this),
+ width = $t.width(),
+ height = $t.height(),
+ fontSize = parseFloat($t.css('font-size')),
+ $heightElement = $('<div>A</div>').css({
+ 'font-size': fontSize,
+ position: 'absolute'
+ }).appendTo(document.body),
+ expectedHeight = $heightElement.height(),
+ minHeight = expectedHeight - tolerance,
+ maxHeight = expectedHeight + tolerance;
+
+ ok('Line ' + j + ' class added.', $t.is('.bigtext-line' + j));
+ if($t.hasClass(BigText.EXEMPT_CLASS)) {
+ // must be added to document to get font-size
+ var defaultDocumentFontSize = parseInt($('<div/>').appendTo(document.body).css('font-size'), 10);
+ equal(defaultDocumentFontSize, fontSize, 'Line ' + j + ' Font size must be unchanged');
+ } else {
+ ok(fontSize > startingFontSize, 'Line ' + j + ' Font size must be larger than the starting pixel size');
+ ok(minWidth < width && width < maxWidth, 'Line ' + j + ' width should be about ' + expectedWidth + 'px (' + width + ')');
+ ok(minHeight < height && height < maxHeight, 'Line ' + j + ' height should be about ' + expectedHeight + 'px (' + minHeight + ' < ' + height + ' < ' + maxHeight + ')');
+ }
+
+ $heightElement.remove();
+ });
+ };
+
+ test('testExists', function()
+ {
+ ok(!!BigText);
+ ok(!!$.fn.bigtext);
+ });
+
+ test('testStyleInjection', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a simple test.</div></div>');
+ $('#test').bigtext();
+
+ equal($('#' + BigText.getStyleId('test')).length, 1, 'Test to make sure the style tag was inserted.');
+ });
+
+ test('testDoubleStyleInjection', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a simple test.</div></div>');
+ $('#test').bigtext().bigtext();
+
+ // FIXME this jQuery result won't return more than one element.
+ ok($('#' + BigText.getStyleId('test')).length === 1, 'Test to make sure the style tag wasn\'t inserted twice.');
+ });
+
+
+ test('testCleanup', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a simple test.</div></div>');
+ $('#test').bigtext();
+
+ ok($('.bigtext-cloned').length === 0, 'Clone should be deleted.');
+ });
+
+ test('testOneLine', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a single line.</div></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ });
+
+ test('testTwoLines', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is</div><div>a longer second line</div></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ });
+
+ test('testThreeLines', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is</div><div>a longer second line</div><div>An even longer third line.</div></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ });
+
+ test('testThreeLinesWithAList', function()
+ {
+ $('#qunit-fixture').html('<ol id="test" style="width:600px"><li>This is</li><li>a longer second line</li><li>An even longer third line.</li></ol>');
+
+ BigTextTest.linesTest('#test', 600);
+ });
+
+ test('testTwoElements', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is</div><div>a longer second line</div></div><div id="test2" style="width:400px"><div>This is</div><div>a longer second line</div></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ BigTextTest.linesTest('#test2', 400);
+
+ notEqual($('#test').find('> div').eq(0).css('font-size'),
+ $('#test2').find('> div').eq(0).css('font-size'),
+ 'Line 1 of each is a different size.');
+
+ notEqual($('#test').find('> div').eq(1).css('font-size'),
+ $('#test2').find('> div').eq(1).css('font-size'),
+ 'Line 2 of each is a different size.');
+ });
+
+ test('testPercentageWidth', function()
+ {
+ $('#qunit-fixture').html('<div style="width: 600px"><div id="test" style="width: 50%"><div>This is a single line.</div></div></div>');
+
+ BigTextTest.linesTest('#test', 300);
+ });
+
+ test('testNoChildren', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width: 600px">This is a single line.</div>');
+
+ BigTextTest.linesTest('#test', 300);
+ });
+
+ test('testMaxFontSize', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div>1</div></div>');
+ $('#test').bigtext();
+
+ equal(BigText.DEFAULT_MAX_FONT_SIZE_PX + 'px',
+ $('#test > div').css('font-size'),
+ 'Font size should equal the maximum.');
+ });
+
+ test('testUnbrokenSingleWord', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:300px"><div>This</div></div>');
+ var startingFontSize = parseInt($('#test > div').css('font-size'), 10);
+ $('#test').bigtext();
+
+ ok(parseInt($('#test > div').css('font-size'), 10) > startingFontSize, 'Font size must be larger than the starting pixel size.');
+ });
+
+ test('testTwoLinesButOneExempt', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:400px"><div>This is</div><div class="bigtext-exempt">a longer second line</div></div>');
+
+ BigTextTest.linesTest('#test', 400);
+ });
+
+ test('testExemptLineWithChild', function()
+ {
+ var defaultExemptLineFontSize,
+ childFontSize,
+ $test = $('#test'),
+ $exempt;
+
+ $('#qunit-fixture').html('<div id="test" style="width:400px"><div>This is</div><div class="bigtext-exempt">a longer <span>second</span> line</div></div>');
+ $exempt = $test.find('.bigtext-exempt');
+
+ defaultExemptLineFontSize = $exempt.css('font-size');
+ $test.bigtext();
+ childFontSize = $exempt.css('font-size');
+
+ equal(defaultExemptLineFontSize, childFontSize, 'Exempt line\'s child font size must be unchanged');
+ });
+
+ test('testIdCssSelectorStyle', function()
+ {
+ var id = 'test-style-insert';
+ // Travic-CI / Ubuntu PhantomJS needed a font-family here (the default font wasn’t bolding correctly)
+ $(document.head || 'head').append( '<style id="' + id + '">#test { width: 600px; font-family: Georgia; font-weight: bold; }</style>' );
+ $('#qunit-fixture').html('<div id="test"><div>This is a single line.</div></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ $('#' + id).remove();
+ });
+
+ test('testMaxWidth', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="max-width:600px"><div>This is a single line.</div></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ });
+
+ test('testNoConflict', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a single line.</div></div>');
+
+ var BT = BigText.noConflict();
+ $.fn.bt = BT.jQueryMethod;
+
+ $('#test').bt();
+
+ var defaultDocumentFontSize = $('<div/>').appendTo(document.body).css('font-size'),
+ childFontSize = $('#test > div').css('font-size');
+
+ notEqual(defaultDocumentFontSize, childFontSize, 'Font size must not equal the default.');
+ });
+
+ test('testMinFontSize', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a super long line that will probably be too long for this single line. This is a super long line that will probably be too long for this single line.</div></div>');
+ $('#test').bigtext({
+ minfontsize: 16
+ });
+
+ equal('16px', $('#test > div').css('font-size'), 'Font size should equal the minimum.');
+ equal('normal', $('#test > div').css('white-space'), 'When minimum is set, word wrap should re-enable.');
+ });
+
+ test('testChildClassReplace', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div class="testbigtext-line1">This is a single line.</div></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ ok($('#test > div').hasClass('testbigtext-line1'), 'First line should still have testbigtext-line1 class');
+ ok(!$('#test > div').hasClass('test'), 'First line should not have test class');
+ });
+
+ test('testTextTransform', function()
+ {
+ $('#qunit-fixture').html('<div style="text-transform: uppercase"><div id="test" style="width:600px"><div class="testbigtext-line1">This is a single line.</div></div></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ });
+
+ test('testWordSpacing', function()
+ {
+ $('#qunit-fixture').html('<div style="word-spacing: 3px"><div id="test" style="width:600px"><div class="testbigtext-line1">This is a single line.</div></div></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ });
+
+ test('testLetterSpacing', function()
+ {
+ $('#qunit-fixture').html('<div style="letter-spacing: 3px"><div id="test" style="width:600px"><div class="testbigtext-line1">This is a single line.</div></div></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ });
+
+ test('testSizes', function()
+ {
+ for( var j = 200, k = 800; j<k; j += 50 ) {
+ $('#qunit-fixture').html('<div id="test" style="width:' + j + 'px"><div>This is a single line.</div></div>');
+
+ BigTextTest.linesTest('#test', j);
+ }
+ });
+
+ test('testSpanChildren', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><span>This is</span><span>a longer second line</span></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ });
+
+ test('testMixtureChildren', function()
+ {
+ $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is</div><span>a longer second line</span></div>');
+
+ BigTextTest.linesTest('#test', 600);
+ });
+}( this, jQuery ));
View
58 bigtext.js → src/bigtext.js
@@ -2,7 +2,9 @@
* https://github.com/zachleat/BigText
* Copyright (c) 2013 @zachleat; Licensed MIT */
-;(function(window, $) {
+(function(window, $) {
+ "use strict";
+
var counter = 0,
$headCache = $('head'),
oldBigText = window.BigText,
@@ -87,14 +89,14 @@
jQueryMethod: function(options)
{
BigText.init();
-
+
options = $.extend({
- minfontsize: BigText.DEFAULT_MIN_FONT_SIZE_PX,
- maxfontsize: BigText.DEFAULT_MAX_FONT_SIZE_PX,
- childSelector: '',
- resize: true
- }, options || {});
-
+ minfontsize: BigText.DEFAULT_MIN_FONT_SIZE_PX,
+ maxfontsize: BigText.DEFAULT_MAX_FONT_SIZE_PX,
+ childSelector: '',
+ resize: true
+ }, options || {});
+
this.each(function()
{
var $t = $(this).addClass('bigtext'),
@@ -106,7 +108,7 @@
id = 'bigtext-id' + (counter++);
$t.attr('id', id);
}
-
+
if(options.resize) {
BigText.bindResize('resize.bigtext-event-' + id, function()
{
@@ -114,16 +116,16 @@
BigText.jQueryMethod.call($('#' + id), options);
});
}
-
+
BigText.clearCss(id);
-
+
$children.addClass(function(lineNumber, className)
{
// remove existing line classes.
return [className.replace(new RegExp('\\b' + BigText.LINE_CLASS_PREFIX + '\\d+\\b'), ''),
BigText.LINE_CLASS_PREFIX + lineNumber].join(' ');
});
-
+
var sizes = calculateSizes($t, $children, maxWidth, options.maxfontsize, options.minfontsize);
$headCache.append(BigText.generateCss(id, sizes.fontSizes, sizes.wordSpacings, sizes.minFontSizes));
});
@@ -135,7 +137,7 @@
function testLineDimensions($line, maxWidth, property, size, interval, units, previousWidth)
{
var width;
- previousWidth = typeof previousWidth == 'number' ? previousWidth : 0;
+ previousWidth = typeof previousWidth === 'number' ? previousWidth : 0;
$line.css(property, size + units);
width = $line.width();
@@ -144,7 +146,7 @@
// console.log(width, ' previous: ' + previousWidth, property + ' at ' + interval, 'prior: ' + (parseFloat(size) - interval), 'new:' + parseFloat(size));
$line.css(property, '');
- if(width == maxWidth) {
+ if(width === maxWidth) {
return {
match: 'exact',
size: parseFloat((parseFloat(size) - 0.1).toFixed(3))
@@ -169,16 +171,17 @@
function calculateSizes($t, $children, maxWidth, maxFontSize, minFontSize)
{
var $c = $t.clone(true)
- .addClass('bigtext-cloned')
- .css({
- fontFamily: $t.css('font-family'),
- textTransform: $t.css('text-transform'),
- wordSpacing: $t.css('word-spacing'),
- letterSpacing: $t.css('letter-spacing'),
- position: 'absolute',
- left: BigText.DEBUG_MODE ? 0 : -9999,
- top: BigText.DEBUG_MODE ? 0 : -9999
- }).appendTo(document.body);
+ .addClass('bigtext-cloned')
+ .css({
+ fontFamily: $t.css('font-family'),
+ textTransform: $t.css('text-transform'),
+ wordSpacing: $t.css('word-spacing'),
+ letterSpacing: $t.css('letter-spacing'),
+ position: 'absolute',
+ left: BigText.DEBUG_MODE ? 0 : -9999,
+ top: BigText.DEBUG_MODE ? 0 : -9999
+ })
+ .appendTo(document.body);
// font-size isn't the only thing we can modify, we can also mess with:
// word-spacing and letter-spacing. WebKit does not respect subpixel
@@ -189,11 +192,12 @@
minFontSizes = [],
ratios = [];
- $children.css('float', 'left').each(function(lineNumber) {
+ $children.css('float', 'left').each(function() {
var $line = $(this),
// TODO replace 8, 4 with a proportional size to the calculated font-size.
intervals = BigText.test.noFractionalFontSize ? [8, 4, 1] : [8, 4, 1, 0.1],
- lineMax;
+ lineMax,
+ newFontSize;
if($line.hasClass(BigText.EXEMPT_CLASS)) {
fontSizes.push(null);
@@ -220,7 +224,7 @@
if(typeof lineMax !== 'number') {
newFontSize = lineMax.size;
- if(lineMax.match == 'exact') {
+ if(lineMax.match === 'exact') {
break outer;
}
break inner;
View
298 test/bigtextTest.js
@@ -1,298 +0,0 @@
-var BigTextTest = {},
- ua = navigator.userAgent;
-
-// Be a little bit more forgiving on IE8 and Travis-CI/Ubuntu + PhantomJS
-if( $.browser.msie && $.browser.version <= 8 ||
- ua.indexOf( 'PhantomJS' ) > -1 && ua.indexOf( 'Linux' ) > -1 ) {
-
- BigTextTest.tolerance = 14;
-} else {
- BigTextTest.tolerance = 10;
-}
-
-// If the lines of text are blocks, testing their width will tell us nothing.
-BigTextTest.init = function()
-{
- return this.css('float', 'left');
-};
-
-BigTextTest.linesTest = function(selector, expectedWidth, options)
-{
- var tolerance = BigTextTest.tolerance,
- minWidth = expectedWidth - tolerance,
- maxWidth = expectedWidth + tolerance,
- options = options || {},
- $test = $(selector),
- $lines = options.childSelector ? $test.find( options.childSelector ) : $test.children(),
- startingFontSize = parseInt($lines.eq(0).css('font-size'), 10);
-
- BigTextTest.init.call($lines);
-
- $lines.each(function(j)
- {
- var width = $(this).width();
- ok(!(( minWidth < width ) && ( width < maxWidth )), 'Pretest: Line ' + j + ' should not be max width (' + minWidth + ' < ' + width + ' < ' + maxWidth + ', font-size: ' + $(this).css('font-size') + ')');
- });
-
- $test.bigtext(options);
-
- ok('Class added.', $test.is('.bigtext'));
-
- $lines.each(function(j)
- {
- var $t = $(this),
- width = $t.width(),
- height = $t.height(),
- fontSize = parseFloat($t.css('font-size')),
- $heightElement = $('<div>A</div>').css({
- 'font-size': fontSize,
- position: 'absolute'
- }).appendTo(document.body),
- expectedHeight = $heightElement.height(),
- minHeight = expectedHeight - tolerance,
- maxHeight = expectedHeight + tolerance;
-
- ok('Line ' + j + ' class added.', $t.is('.bigtext-line' + j));
- if($t.hasClass(BigText.EXEMPT_CLASS)) {
- // must be added to document to get font-size
- var defaultDocumentFontSize = parseInt($('<div/>').appendTo(document.body).css('font-size'), 10);
- equal(defaultDocumentFontSize, fontSize, 'Line ' + j + ' Font size must be unchanged');
- } else {
- ok(fontSize > startingFontSize, 'Line ' + j + ' Font size must be larger than the starting pixel size');
- ok(minWidth < width && width < maxWidth, 'Line ' + j + ' width should be about ' + expectedWidth + 'px (' + width + ')');
- ok(minHeight < height && height < maxHeight, 'Line ' + j + ' height should be about ' + expectedHeight + 'px (' + minHeight + ' < ' + height + ' < ' + maxHeight + ')');
- }
-
- $heightElement.remove();
- });
-};
-
-test('testExists', function()
-{
- ok(!!BigText);
- ok(!!$.fn.bigtext);
-});
-
-test('testStyleInjection', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a simple test.</div></div>');
- $('#test').bigtext();
-
- equal($('#' + BigText.getStyleId('test')).length, 1, 'Test to make sure the style tag was inserted.');
-});
-
-test('testDoubleStyleInjection', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a simple test.</div></div>');
- $('#test').bigtext().bigtext();
-
- // FIXME this jQuery result won't return more than one element.
- ok($('#' + BigText.getStyleId('test')).length === 1, 'Test to make sure the style tag wasn\'t inserted twice.');
-});
-
-
-test('testCleanup', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a simple test.</div></div>');
- $('#test').bigtext();
-
- ok($('.bigtext-cloned').length === 0, 'Clone should be deleted.');
-});
-
-test('testOneLine', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a single line.</div></div>');
-
- BigTextTest.linesTest('#test', 600);
-});
-
-test('testTwoLines', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is</div><div>a longer second line</div></div>');
-
- BigTextTest.linesTest('#test', 600);
-});
-
-test('testThreeLines', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is</div><div>a longer second line</div><div>An even longer third line.</div></div>');
-
- BigTextTest.linesTest('#test', 600);
-});
-
-test('testThreeLinesWithAList', function()
-{
- $('#qunit-fixture').html('<ol id="test" style="width:600px"><li>This is</li><li>a longer second line</li><li>An even longer third line.</li></ol>');
-
- BigTextTest.linesTest('#test', 600);
-});
-
-test('testTwoElements', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is</div><div>a longer second line</div></div><div id="test2" style="width:400px"><div>This is</div><div>a longer second line</div></div>');
-
- BigTextTest.linesTest('#test', 600);
- BigTextTest.linesTest('#test2', 400);
-
- notEqual($('#test').find('> div').eq(0).css('font-size'),
- $('#test2').find('> div').eq(0).css('font-size'),
- 'Line 1 of each is a different size.');
-
- notEqual($('#test').find('> div').eq(1).css('font-size'),
- $('#test2').find('> div').eq(1).css('font-size'),
- 'Line 2 of each is a different size.');
-});
-
-test('testPercentageWidth', function()
-{
- $('#qunit-fixture').html('<div style="width: 600px"><div id="test" style="width: 50%"><div>This is a single line.</div></div></div>');
-
- BigTextTest.linesTest('#test', 300);
-});
-
-test('testNoChildren', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width: 600px">This is a single line.</div>');
-
- BigTextTest.linesTest('#test', 300);
-});
-
-test('testMaxFontSize', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div>1</div></div>');
- $('#test').bigtext();
-
- equal(BigText.DEFAULT_MAX_FONT_SIZE_PX + 'px',
- $('#test > div').css('font-size'),
- 'Font size should equal the maximum.');
-});
-
-test('testUnbrokenSingleWord', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:300px"><div>This</div></div>');
- var startingFontSize = parseInt($('#test > div').css('font-size'), 10);
- $('#test').bigtext();
-
- ok(parseInt($('#test > div').css('font-size'), 10) > startingFontSize, 'Font size must be larger than the starting pixel size.');
-});
-
-test('testTwoLinesButOneExempt', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:400px"><div>This is</div><div class="bigtext-exempt">a longer second line</div></div>');
-
- BigTextTest.linesTest('#test', 400);
-});
-
-test('testExemptLineWithChild', function()
-{
- var defaultExemptLineFontSize,
- childFontSize,
- $test = $('#test'),
- $exempt;
-
- $('#qunit-fixture').html('<div id="test" style="width:400px"><div>This is</div><div class="bigtext-exempt">a longer <span>second</span> line</div></div>');
- $exempt = $test.find('.bigtext-exempt');
-
- defaultExemptLineFontSize = $exempt.css('font-size');
- $test.bigtext();
- childFontSize = $exempt.css('font-size');
-
- equal(defaultExemptLineFontSize, childFontSize, 'Exempt line\'s child font size must be unchanged');
-});
-
-test('testIdCssSelectorStyle', function()
-{
- var id = 'test-style-insert';
- // Travic-CI / Ubuntu PhantomJS needed a font-family here (the default font wasn’t bolding correctly)
- $(document.head || 'head').append( '<style id="' + id + '">#test { width: 600px; font-family: Georgia; font-weight: bold; }</style>' );
- $('#qunit-fixture').html('<div id="test"><div>This is a single line.</div></div>');
-
- BigTextTest.linesTest('#test', 600);
- $('#' + id).remove();
-});
-
-test('testMaxWidth', function()
-{
- $('#qunit-fixture').html('<div id="test" style="max-width:600px"><div>This is a single line.</div></div>');
-
- BigTextTest.linesTest('#test', 600);
-});
-
-test('testNoConflict', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a single line.</div></div>');
-
- var BT = BigText.noConflict();
- $.fn.bt = BT.jQueryMethod;
-
- $('#test').bt();
-
- var defaultDocumentFontSize = $('<div/>').appendTo(document.body).css('font-size'),
- childFontSize = $('#test > div').css('font-size');
-
- notEqual(defaultDocumentFontSize, childFontSize, 'Font size must not equal the default.');
-});
-
-test('testMinFontSize', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is a super long line that will probably be too long for this single line. This is a super long line that will probably be too long for this single line.</div></div>');
- $('#test').bigtext({
- minfontsize: 16
- });
-
- equal('16px', $('#test > div').css('font-size'), 'Font size should equal the minimum.');
- equal('normal', $('#test > div').css('white-space'), 'When minimum is set, word wrap should re-enable.');
-});
-
-test('testChildClassReplace', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div class="testbigtext-line1">This is a single line.</div></div>');
-
- BigTextTest.linesTest('#test', 600);
- ok($('#test > div').hasClass('testbigtext-line1'), 'First line should still have testbigtext-line1 class');
- ok(!$('#test > div').hasClass('test'), 'First line should not have test class');
-});
-
-test('testTextTransform', function()
-{
- $('#qunit-fixture').html('<div style="text-transform: uppercase"><div id="test" style="width:600px"><div class="testbigtext-line1">This is a single line.</div></div></div>');
-
- BigTextTest.linesTest('#test', 600);
-});
-
-test('testWordSpacing', function()
-{
- $('#qunit-fixture').html('<div style="word-spacing: 3px"><div id="test" style="width:600px"><div class="testbigtext-line1">This is a single line.</div></div></div>');
-
- BigTextTest.linesTest('#test', 600);
-});
-
-test('testLetterSpacing', function()
-{
- $('#qunit-fixture').html('<div style="letter-spacing: 3px"><div id="test" style="width:600px"><div class="testbigtext-line1">This is a single line.</div></div></div>');
-
- BigTextTest.linesTest('#test', 600);
-});
-
-test('testSizes', function()
-{
- for( var j = 200, k = 800; j<k; j += 50 ) {
- $('#qunit-fixture').html('<div id="test" style="width:' + j + 'px"><div>This is a single line.</div></div>');
-
- BigTextTest.linesTest('#test', j);
- }
-});
-
-test('testSpanChildren', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><span>This is</span><span>a longer second line</span></div>');
-
- BigTextTest.linesTest('#test', 600);
-});
-
-test('testMixtureChildren', function()
-{
- $('#qunit-fixture').html('<div id="test" style="width:600px"><div>This is</div><span>a longer second line</span></div>');
-
- BigTextTest.linesTest('#test', 600);
-});
View
9,789 test/lib/jquery-1.10.2.js
0 additions, 9,789 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
35 test/lib/jquery-partial-migrate.js
@@ -1,35 +0,0 @@
-jQuery.uaMatch = function( ua ) {
- ua = ua.toLowerCase();
-
- var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
- /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
- /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
- /(msie) ([\w.]+)/.exec( ua ) ||
- ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
- [];
-
- return {
- browser: match[ 1 ] || "",
- version: match[ 2 ] || "0"
- };
-};
-
-// Don't clobber any existing jQuery.browser in case it's different
-if ( !jQuery.browser ) {
- matched = jQuery.uaMatch( navigator.userAgent );
- browser = {};
-
- if ( matched.browser ) {
- browser[ matched.browser ] = true;
- browser.version = matched.version;
- }
-
- // Chrome is Webkit, but Webkit is also Safari.
- if ( browser.chrome ) {
- browser.webkit = true;
- } else if ( browser.webkit ) {
- browser.safari = true;
- }
-
- jQuery.browser = browser;
-}
View
244 test/lib/qunit-1.12.0.css
@@ -1,244 +0,0 @@
-/**
- * QUnit v1.12.0 - A JavaScript Unit Testing Framework
- *
- * http://qunitjs.com
- *
- * Copyright 2012 jQuery Foundation and other contributors
- * Released under the MIT license.
- * http://jquery.org/license
- */
-
-/** Font Family and Sizes */
-
-#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
- font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
-}
-
-#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
-#qunit-tests { font-size: smaller; }
-
-
-/** Resets */
-
-#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
- margin: 0;
- padding: 0;
-}
-
-
-/** Header */
-
-#qunit-header {
- padding: 0.5em 0 0.5em 1em;
-
- color: #8699a4;
- background-color: #0d3349;
-
- font-size: 1.5em;
- line-height: 1em;
- font-weight: normal;
-
- border-radius: 5px 5px 0 0;
- -moz-border-radius: 5px 5px 0 0;
- -webkit-border-top-right-radius: 5px;
- -webkit-border-top-left-radius: 5px;
-}
-
-#qunit-header a {
- text-decoration: none;
- color: #c2ccd1;
-}
-
-#qunit-header a:hover,
-#qunit-header a:focus {
- color: #fff;
-}
-
-#qunit-testrunner-toolbar label {
- display: inline-block;
- padding: 0 .5em 0 .1em;
-}
-
-#qunit-banner {
- height: 5px;
-}
-
-#qunit-testrunner-toolbar {
- padding: 0.5em 0 0.5em 2em;
- color: #5E740B;
- background-color: #eee;
- overflow: hidden;
-}
-
-#qunit-userAgent {
- padding: 0.5em 0 0.5em 2.5em;
- background-color: #2b81af;
- color: #fff;
- text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
-}
-
-#qunit-modulefilter-container {
- float: right;
-}
-
-/** Tests: Pass/Fail */
-
-#qunit-tests {
- list-style-position: inside;
-}
-
-#qunit-tests li {
- padding: 0.4em 0.5em 0.4em 2.5em;
- border-bottom: 1px solid #fff;
- list-style-position: inside;
-}
-
-#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
- display: none;
-}
-
-#qunit-tests li strong {
- cursor: pointer;
-}
-
-#qunit-tests li a {
- padding: 0.5em;
- color: #c2ccd1;
- text-decoration: none;
-}
-#qunit-tests li a:hover,
-#qunit-tests li a:focus {
- color: #000;
-}
-
-#qunit-tests li .runtime {
- float: right;
- font-size: smaller;
-}
-
-.qunit-assert-list {
- margin-top: 0.5em;
- padding: 0.5em;
-
- background-color: #fff;
-
- border-radius: 5px;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
-}
-
-.qunit-collapsed {
- display: none;
-}
-
-#qunit-tests table {
- border-collapse: collapse;
- margin-top: .2em;
-}
-
-#qunit-tests th {
- text-align: right;
- vertical-align: top;
- padding: 0 .5em 0 0;
-}
-
-#qunit-tests td {
- vertical-align: top;
-}
-
-#qunit-tests pre {
- margin: 0;
- white-space: pre-wrap;
- word-wrap: break-word;
-}
-
-#qunit-tests del {
- background-color: #e0f2be;
- color: #374e0c;
- text-decoration: none;
-}
-
-#qunit-tests ins {
- background-color: #ffcaca;
- color: #500;
- text-decoration: none;
-}
-
-/*** Test Counts */
-
-#qunit-tests b.counts { color: black; }
-#qunit-tests b.passed { color: #5E740B; }
-#qunit-tests b.failed { color: #710909; }
-
-#qunit-tests li li {
- padding: 5px;
- background-color: #fff;
- border-bottom: none;
- list-style-position: inside;
-}
-
-/*** Passing Styles */
-
-#qunit-tests li li.pass {
- color: #3c510c;
- background-color: #fff;
- border-left: 10px solid #C6E746;
-}
-
-#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
-#qunit-tests .pass .test-name { color: #366097; }
-
-#qunit-tests .pass .test-actual,
-#qunit-tests .pass .test-expected { color: #999999; }
-
-#qunit-banner.qunit-pass { background-color: #C6E746; }
-
-/*** Failing Styles */
-
-#qunit-tests li li.fail {
- color: #710909;
- background-color: #fff;
- border-left: 10px solid #EE5757;
- white-space: pre;
-}
-
-#qunit-tests > li:last-child {
- border-radius: 0 0 5px 5px;
- -moz-border-radius: 0 0 5px 5px;
- -webkit-border-bottom-right-radius: 5px;
- -webkit-border-bottom-left-radius: 5px;
-}
-
-#qunit-tests .fail { color: #000000; background-color: #EE5757; }
-#qunit-tests .fail .test-name,
-#qunit-tests .fail .module-name { color: #000000; }
-
-#qunit-tests .fail .test-actual { color: #EE5757; }
-#qunit-tests .fail .test-expected { color: green; }
-
-#qunit-banner.qunit-fail { background-color: #EE5757; }
-
-
-/** Result */
-
-#qunit-testresult {
- padding: 0.5em 0.5em 0.5em 2.5em;
-
- color: #2b81af;
- background-color: #D2E0E6;
-
- border-bottom: 1px solid white;
-}
-#qunit-testresult .module-name {
- font-weight: bold;
-}
-
-/** Fixture */
-
-#qunit-fixture {
- position: absolute;
- top: -10000px;
- left: -10000px;
- width: 1000px;
- height: 1000px;
-}
View
2,212 test/lib/qunit-1.12.0.js
0 additions, 2,212 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
5 test/lib/underscore-1.5.2.js
@@ -1,5 +0,0 @@
-// Underscore.js 1.5.2
-// http://underscorejs.org
-// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
-// Underscore may be freely distributed under the MIT license.
-(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?(this._wrapped=n,void 0):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.5.2";var A=j.each=j.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var E="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(E);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},j.find=j.detect=function(n,t,r){var e;return O(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var O=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:O(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,function(n){return n[t]})},j.where=function(n,t,r){return j.isEmpty(t)?r?void 0:[]:j[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},j.findWhere=function(n,t){return j.where(n,t,!0)},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);if(!t&&j.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>e.computed&&(e={value:n,computed:a})}),e.value},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);if(!t&&j.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a<e.computed&&(e={value:n,computed:a})}),e.value},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return arguments.length<2||r?n[j.random(n.length-1)]:j.shuffle(n).slice(0,Math.max(0,t))};var k=function(n){return j.isFunction(n)?n:function(t){return t[n]}};j.sortBy=function(n,t,r){var e=k(t);return j.pluck(j.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={},i=null==r?j.identity:k(r);return A(t,function(r,a){var o=i.call(e,r,a,t);n(u,o,r)}),u}};j.groupBy=F(function(n,t,r){(j.has(n,t)?n[t]:n[t]=[]).push(r)}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=null==r?j.identity:k(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}return i},j.toArray=function(n){return n?j.isArray(n)?o.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},j.size=function(n){return null==n?0:n.length===+n.length?n.length:j.keys(n).length},j.first=j.head=j.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.indexOf(t,n)>=0})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},j.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var r={};return t||(t=j.identity),function(){var e=t.apply(this,arguments);return j.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},j.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(o.call(arguments,1)))},j.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var c=function(){o=r.leading===!1?0:new Date,a=null,i=n.apply(e,u)};return function(){var l=new Date;o||r.leading!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u)):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o;return function(){i=this,u=arguments,a=new Date;var c=function(){var l=new Date-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u)))},l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u)),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=w||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o))return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var I={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};I.unescape=j.invert(I.escape);var T={escape:new RegExp("["+j.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(I.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(T[n],function(t){return I[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this);
View
34 test/test.html
@@ -1,24 +1,24 @@
<!DOCTYPE html>
<html>
<head>
- <meta charset="utf-8">
- <title>BigText QUnit Tests</title>
- <link rel="stylesheet" href="lib/qunit-1.12.0.css">
- <style>
- ol, ul {
- margin: 0;
- padding: 0;
- }
- </style>
+ <meta charset="utf-8">
+ <title>GRUNTLERPLATE Test Suite</title>
+ <!-- Load local jQuery, removing access to $ (use jQuery, not $). -->
+ <script src="../bower_components/jquery/dist/jquery.js"></script>
+ <script>jQuery.noConflict()</script>
+ <!-- Load local QUnit (grunt requires v1.0.0 or newer). -->
+ <link rel="stylesheet" href="../bower_components/qunit/qunit/qunit.css">
+ <script src="../bower_components/qunit/qunit/qunit.js"></script>
+ <!-- Load local lib and tests. -->
+ <script src="../dist/bigtext.js"></script>
+ <script src="../dist/test/tests.js"></script>
</head>
<body>
- <div id="qunit"></div>
- <div id="qunit-fixture"></div>
- <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
- <script src="lib/jquery-partial-migrate.js"></script>
- <script src="lib/qunit-1.12.0.js"></script>
- <script src="lib/underscore-1.5.2.js"></script>
- <script src="../bigtext.js"></script>
- <script src="bigtextTest.js"></script>
+ <h1 id="qunit-header">GRUNTLERPLATE Test Suite</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture"></div>
</body>
</html>

0 comments on commit 60dc6db

Please sign in to comment.
Something went wrong with that request. Please try again.