@ui-grid/core
Advanced tools
Comparing version 4.8.5 to 4.9.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [4.9.0](https://github.com/angular-ui/ui-grid/compare/v4.8.5...v4.9.0) (2020-09-27) | ||
### Bug Fixes | ||
* 🐛 replace missing string with empty string ([f7d48ee](https://github.com/angular-ui/ui-grid/commit/f7d48ee4e28f8a1233d0dc1bf4e10a5446df6e32)), closes [#7063](https://github.com/angular-ui/ui-grid/issues/7063) | ||
### BREAKING CHANGES | ||
* MISSING string will no longer be displayed. | ||
## [4.8.5](https://github.com/angular-ui/ui-grid/compare/v4.8.3...v4.8.5) (2020-09-14) | ||
@@ -8,0 +24,0 @@ |
{ | ||
"name": "@ui-grid/core", | ||
"version": "4.8.5", | ||
"version": "4.9.0", | ||
"description": "A data grid for Angular", | ||
@@ -35,3 +35,3 @@ "main": "index.js", | ||
"license": "MIT", | ||
"gitHead": "e4b26a0231bc66a35cf511f9721965ec13b0ac6e" | ||
"gitHead": "e222d8f45f5c09fac13ef374d8c692f3b5163a40" | ||
} |
@@ -101,2 +101,7 @@ /** | ||
function getMissingText(path) { | ||
$log.warn(i18nConstants.MISSING + path); | ||
return ''; | ||
} | ||
var service = { | ||
@@ -178,10 +183,9 @@ | ||
trans = langCache.get(language), | ||
missing = i18nConstants.MISSING + path, | ||
getter = $parse(path); | ||
if (!trans) { | ||
return missing; | ||
return getMissingText(path); | ||
} | ||
return getter(trans) || missing; | ||
return getter(trans) || getMissingText(path); | ||
}, | ||
@@ -188,0 +192,0 @@ |
@@ -63,7 +63,7 @@ describe('i18n Directives', function() { | ||
}); | ||
it('should get missing text for missing property', function() { | ||
it('should get empty string for missing property', function() { | ||
element = angular.element('<div ui-i18n="en"><p ui-translate="search.bad.text"></p></div>'); | ||
recompile(); | ||
expect(element.find('p').text()).toBe('[MISSING]search.bad.text'); | ||
expect(element.find('p').text()).toBe(''); | ||
}); | ||
@@ -102,11 +102,11 @@ }); | ||
}); | ||
it('should get missing text for missing property', function() { | ||
it('should get empty string for missing property', function() { | ||
element = angular.element('<div ui-i18n="en"><p ui-t="search.bad.text"></p></div>'); | ||
recompile(); | ||
expect(element.find('p').text()).toBe('[MISSING]search.bad.text'); | ||
expect(element.find('p').text()).toBe(''); | ||
$rootScope.$broadcast('$uiI18n'); | ||
expect(element.find('p').text()).toBe('[MISSING]search.bad.text'); | ||
expect(element.find('p').text()).toBe(''); | ||
}); | ||
@@ -125,7 +125,7 @@ }); | ||
}); | ||
it('should get missing text for missing property', function() { | ||
it('should get empty string for missing property', function() { | ||
element = angular.element('<div ui-i18n="en"><p>{{"search.bad.text" | t}}</p></div>'); | ||
recompile(); | ||
expect(element.find('p').text()).toBe('[MISSING]search.bad.text'); | ||
expect(element.find('p').text()).toBe(''); | ||
}); | ||
@@ -150,9 +150,9 @@ }); | ||
}); | ||
it('should get missing text for missing property', function() { | ||
it('should get empty string for missing property', function() { | ||
element = angular.element('<div ui-i18n="en"><p>{{"search.bad.text" | uiTranslate}}</p></div>'); | ||
recompile(); | ||
expect(element.find('p').text()).toBe('[MISSING]search.bad.text'); | ||
expect(element.find('p').text()).toBe(''); | ||
}); | ||
}); | ||
}); |
describe('i18nService', function () { | ||
var i18nConstants, i18nService; | ||
var $log, i18nConstants, i18nService; | ||
beforeEach(function() { | ||
module('ui.grid'); | ||
$log = jasmine.createSpyObj('$log', ['warn']); | ||
module('ui.grid', function($provide) { | ||
$provide.value('$log', $log) | ||
}); | ||
inject(function (_i18nConstants_, _i18nService_) { | ||
@@ -11,2 +14,5 @@ i18nConstants = _i18nConstants_; | ||
}); | ||
afterEach(function() { | ||
$log.warn.calls.reset(); | ||
}); | ||
@@ -81,6 +87,7 @@ describe('i18n service', function() { | ||
}); | ||
it('should get missing text for missing property', function() { | ||
it('should get empty string for missing property', function() { | ||
var badText = 'search.bad.text'; | ||
expect(i18nService.getSafeText(badText)).toBe(i18nConstants.MISSING + badText); | ||
expect(i18nService.getSafeText(badText)).toBe(''); | ||
expect($log.warn).toHaveBeenCalledWith(i18nConstants.MISSING + badText); | ||
}); | ||
@@ -90,18 +97,21 @@ it('should get fallback text when language is missing or nonexistent', function() { | ||
}); | ||
it('should get missing text when language is missing or nonexistent and there is no fallback', function() { | ||
it('should get empty string when language is missing or nonexistent and there is no fallback', function() { | ||
var badText = 'bad.text'; | ||
expect(i18nService.getSafeText(badText, 'valerian')).toBe(i18nConstants.MISSING + badText); | ||
expect(i18nService.getSafeText(badText, 'valerian')).toBe(''); | ||
expect($log.warn).toHaveBeenCalledWith(i18nConstants.MISSING + badText); | ||
}); | ||
it('should get missing text when language is missing or nonexistent and the fallback language is the same', function() { | ||
it('should get empty string when language is missing or nonexistent and the fallback language is the same', function() { | ||
var missingProperty = 'search.placeholder'; | ||
i18nService.setFallbackLang('valerian'); | ||
expect(i18nService.getSafeText(missingProperty, 'valerian')).toBe(i18nConstants.MISSING + missingProperty); | ||
expect(i18nService.getSafeText(missingProperty, 'valerian')).toBe(''); | ||
expect($log.warn).toHaveBeenCalledWith(i18nConstants.MISSING + missingProperty); | ||
}); | ||
it('should get missing text when language is missing or nonexistent and the fallback language is also missing it', function() { | ||
it('should get empty string when language is missing or nonexistent and the fallback language is also missing it', function() { | ||
var missingProperty = 'search.placeholder'; | ||
i18nService.setFallbackLang('orcish'); | ||
expect(i18nService.getSafeText(missingProperty, 'valerian')).toBe(i18nConstants.MISSING + missingProperty); | ||
expect(i18nService.getSafeText(missingProperty, 'valerian')).toBe(''); | ||
expect($log.warn).toHaveBeenCalledWith(i18nConstants.MISSING + missingProperty); | ||
}); | ||
@@ -108,0 +118,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1456733
29588