Skip to content

Commit

Permalink
Update testing for Joomla.JText
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedik committed Aug 21, 2016
1 parent 2078f5b commit d305e26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 5 additions & 1 deletion tests/javascript/core/fixtures/fixture.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
<script type="application/json" class="joomla-script-options new">{
"com_foobar": ["my options"],
"com_foobar2": "Alert message!",
"com_foobar3": false
"com_foobar3": false,
"joomla.jtext": {
"string1": "String 1",
"STRING2": "String 2"
}
}</script>
</div>
</div>
13 changes: 10 additions & 3 deletions tests/javascript/core/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ define(['jquery', 'testsRoot/core/spec-setup', 'jasmineJquery'], function ($) {
it('should return \'test\' on calling Joomla.JText._(\'JTOGGLE_REMOVE_SIDEBAR\', \'test\')', function () {
expect(Joomla.JText._('JTOGGLE_REMOVE_SIDEBAR', 'test')).toEqual('test');
});

// Test strings in optionsStorage
it('should return \'String 1\' on calling Joomla.JText._(\'stRing1\')', function () {
expect(Joomla.JText._('stRing1')).toEqual('String 1');
});
it('should return \'String 2\' on calling Joomla.JText._(\'StrinG2\')', function () {
expect(Joomla.JText._('StrinG2')).toEqual('String 2');
});

});

describe('Core Joomla.replaceTokens', function () {
Expand Down Expand Up @@ -200,9 +209,7 @@ define(['jquery', 'testsRoot/core/spec-setup', 'jasmineJquery'], function ($) {
});

describe('Core Joomla.getOptions', function () {
it('should be Joomla.optionsStorage = null', function () {
expect(Joomla.optionsStorage).toEqual(null)
});

it('should return options array Joomla.getOptions("com_foobar")', function () {
expect(Joomla.getOptions("com_foobar")).toEqual(["my options"])
});
Expand Down

0 comments on commit d305e26

Please sign in to comment.