dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41609
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21211: Added tests for trimvariablequalifiers filters
------------------------------------------------------------
revno: 21211
committer: Jiju K Jose <jijukjose@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-11-27 10:26:14 +0100
message:
Added tests for trimvariablequalifiers filters
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/test/filters/dhis2.angular.filters.test.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/test/filters/dhis2.angular.filters.test.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/test/filters/dhis2.angular.filters.test.js 2015-11-27 08:51:37 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/test/filters/dhis2.angular.filters.test.js 2015-11-27 09:26:14 +0000
@@ -4,16 +4,43 @@
beforeEach(module('d2Filters'));
+ /*TODO: paginate filters */
+
describe('d2Filter: trimquotesFilter', () => {
let trimquotesFilter;
+
beforeEach(inject(($injector) => {
trimquotesFilter = $injector.get('trimquotesFilter');
}));
it('should trim the initial single and double quotes', function() {
- var trimmedString = trimquotesFilter('"testString"');
- expect(trimmedString).to.equal('testString');
- });
+ expect(trimquotesFilter('"testString"')).to.equal('testString');
+ expect(trimquotesFilter('{{testString::')).to.equal('{{testString::');
+ });
+ it('should return the same input if the input is not a string', function() {
+ expect(trimquotesFilter(25)).to.equal(25);
+ });
+
+ });
+
+ describe('d2Filter: trimvariablequalifiers', () => {
+ let trimvariablequalifiersFilter;
+
+ beforeEach(inject(($injector) => {
+ trimvariablequalifiersFilter = $injector.get('trimvariablequalifiersFilter');
+ }));
+
+ it('should trim the characters matching /^[#VCAvca]{ in the begnnind and /}', function() {
+ let beginningCharsToFilter = ["V{","C{","A{",,"#{","v{",,"c{",,"a{"];
+ beginningCharsToFilter.forEach(function(beginningString){
+ expect(trimvariablequalifiersFilter(beginningString+'testString}')).to.equal('testString');
+ expect(trimvariablequalifiersFilter(beginningString+'testStringTT')).to.equal('testStringTT');
+ });
+ });
+
+ it('should return the same input if the input is not a string', function() {
+ expect(trimvariablequalifiersFilter(25)).to.equal(25);
+ });
});
});
\ No newline at end of file