-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(t-attribute): fallback on missing key
if a missing key is provided to the T-Attribute, the original value (text/innerhtml) is kept and a warning logged to the console fixes issue #267
- Loading branch information
Showing
7 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { StageComponent } from 'aurelia-testing'; | ||
import { bootstrap } from 'aurelia-bootstrapper'; | ||
|
||
import { bootstrapTestEnvironment } from './staging-helpers'; | ||
|
||
describe('staged tests', () => { | ||
it('should keep original value instead of fallback to key, when defined via options', done => { | ||
const target = 'fallback-target'; | ||
const component = StageComponent | ||
.withResources('test/unit/mocks/rt-vm') | ||
.inView('<h5 id=' + target + ' t="hello">Hello!</h5>') | ||
.boundTo({ mydate: new Date() }); | ||
|
||
bootstrapTestEnvironment(component, { | ||
resources: { | ||
en: { | ||
translation: { | ||
hello: undefined | ||
} | ||
} | ||
}, | ||
skipTranslationOnMissingKey: true | ||
}); | ||
|
||
component.create(bootstrap) | ||
.then(() => { | ||
const elem = document.getElementById(target); | ||
expect(elem.innerHTML).toBe('Hello!'); | ||
|
||
component.dispose(); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters