Permalink
Browse files

test module for apnumber

  • Loading branch information...
1 parent 5501ac7 commit d5614172ef444c10d7e8a056a65d3967e899abb6 @dryan committed Jun 6, 2011
Showing with 31 additions and 0 deletions.
  1. +30 −0 django.filters.apnumber-test.js
  2. +1 −0 test.html
@@ -0,0 +1,30 @@
+module('django.filters.apnumber');
+
+test('apnumber', 12, function() {
+ equal(django.filters.apnumber(1), 'one', '1');
+ equal(django.filters.apnumber(2), 'two', '2');
+ equal(django.filters.apnumber(3), 'three', '3');
+ equal(django.filters.apnumber(4), 'four', '4');
+ equal(django.filters.apnumber(5), 'five', '5');
+ equal(django.filters.apnumber(6), 'six', '6');
+ equal(django.filters.apnumber(7), 'seven', '7');
+ equal(django.filters.apnumber(8), 'eight', '8');
+ equal(django.filters.apnumber(9), 'nine', '9');
+ equal(django.filters.apnumber(10), '10', '10');
+ equal(django.filters.apnumber(100), '100', '100');
+ equal(django.filters.apnumber('monkeybat'), 'monkeybat', 'not a number');
+});
+
+test('apnumber_reverse', 11, function() {
+ equal(django.filters.apnumber_reverse('one'), 1, '1');
+ equal(django.filters.apnumber_reverse('two'), 2, '2');
+ equal(django.filters.apnumber_reverse('three'), 3, '3');
+ equal(django.filters.apnumber_reverse('four'), 4, '4');
+ equal(django.filters.apnumber_reverse('five'), 5, '5');
+ equal(django.filters.apnumber_reverse('six'), 6, '6');
+ equal(django.filters.apnumber_reverse('seven'), 7, '7');
+ equal(django.filters.apnumber_reverse('eight'), 8, '8');
+ equal(django.filters.apnumber_reverse('nine'), 9, '9');
+ equal(django.filters.apnumber_reverse('ten'), 'ten', '10');
+ equal(django.filters.apnumber_reverse('100'), 100, '100');
+});
View
@@ -9,6 +9,7 @@
<script type="text/javascript" src="django.filters.date-test.js"></script>
<script type="text/javascript" src="django.filters.utils-test.js"></script>
<script type="text/javascript" src="django.filters.intcomma-test.js"></script>
+ <script type="text/javascript" src="django.filters.apnumber-test.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Test Suite</h1>

0 comments on commit d561417

Please sign in to comment.