diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..0dd80f1 --- /dev/null +++ b/bower.json @@ -0,0 +1,22 @@ +{ + "name": "jQuery-Slugify-Plugin", + "version": "1.0.0", + "homepage": "https://github.com/pmcelhaney/jQuery-Slugify-Plugin", + "authors": [ + "Patrick McElhaney <pmcelhaney@gmail.com>" + ], + "description": "Creates a URL slug as you type a page title", + "main": "jquery.slugify.js", + "keywords": [ + "slug", + "jquery" + ], + "license": "BSD", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/tests/tests.html b/tests/tests.html new file mode 100644 index 0000000..9ed5d8b --- /dev/null +++ b/tests/tests.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <title>jQuery Slugify</title> + <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.17.1.css"> +</head> +<body> +<div id="qunit"></div> +<div id="qunit-fixture"></div> + +<div> + <input type="text" value="" id="slug-source"/> +</div> +<div> + <input type="text" value="" id="slug-target"/> +</div> + +<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script> +<script src="../jquery.slugify.js"></script> +<script src="http://code.jquery.com/qunit/qunit-1.17.1.js"></script> +<script src="tests.js"></script> +</body> +</html> \ No newline at end of file diff --git a/tests/tests.js b/tests/tests.js new file mode 100644 index 0000000..74dc336 --- /dev/null +++ b/tests/tests.js @@ -0,0 +1,23 @@ +(function($) { + + module('jQuery#slugify', { + setup: function () { + + } + }); + + test('test the DOM function on change', function () { + expect(1); + $('#slug-target').slugify('#slug-source'); + $('#slug-source').val('this test hás špeical characters & ćrāžÿ-śtrįngs ').trigger('change'); + equal($('#slug-target').val(), 'this-test-has-speical-characters-and-crazy-strings', "Correct slug in target field change event"); + }); + + test('test the DOM function on keyup', function () { + expect(1); + $('#slug-target').slugify('#slug-source'); + $('#slug-source').val('this test hás špeical characters & ćrāžÿ-śtrįngs ').trigger('change'); + equal($('#slug-target').val(), 'this-test-has-speical-characters-and-crazy-strings', "Correct slug in target field with keyup event"); + }); + +}(jQuery)); \ No newline at end of file