Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
24 changes: 24 additions & 0 deletions tests/tests.html
Original file line number Diff line number Diff line change
@@ -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>
23 changes: 23 additions & 0 deletions tests/tests.js
Original file line number Diff line number Diff line change
@@ -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));