github.com/justinjmoses/evergreen@v0.0.0-20170530173719-1d50e381ff0d/public/static/js/tests/filters.capitalize.test.js (about) 1 /** 2 * filters.capitalize.test.js 3 * 4 * Created on: September 12, 2013 5 * Author: Valeri Karpov 6 * 7 * Karma-based unit tests for the capitalize filter, which should convert the first letter of 8 * each word in the input to upper case. 9 * (see public/static/js/tests/conf/karma.conf.js) 10 * 11 */ 12 13 describe('capitalize', function() { 14 beforeEach(module('filters.common')); 15 16 it("should do nothing for a string which has no words", inject(function($filter) { 17 expect( $filter('capitalize')("37signals") ).toBe("37signals"); 18 })); 19 20 it("should convert a single word to upper case", inject(function($filter) { 21 expect( $filter('capitalize')("unstarted") ). 22 toBe("Unstarted"); 23 })); 24 25 it("should avoid isolated numbers", inject(function($filter) { 26 expect( $filter('capitalize')("2 chainz") ). 27 toBe("2 Chainz"); 28 })); 29 30 it("should handle multiple words", inject(function($filter) { 31 expect( $filter('capitalize')("I ate 2 apples") ). 32 toBe("I Ate 2 Apples"); 33 })); 34 });