-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20634 from nextcloud/legacy-avatar-placeholder
Generate legacy image placeholder text by taking first letters
- Loading branch information
Showing
4 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,43 @@ | ||
/** | ||
* Copyright (c) 2019 Serhii Shliakhov <[email protected]> | ||
* | ||
* This file is licensed under the Affero General Public License version 3 | ||
* or later. | ||
* | ||
* See the COPYING-README file. | ||
* | ||
*/ | ||
|
||
describe('jquery.placeholder tests', function() { | ||
|
||
var $div; | ||
|
||
beforeEach(function() { | ||
$('#testArea').append($('<div id="placeholderdiv">')); | ||
$div = $('#placeholderdiv'); | ||
}); | ||
|
||
afterEach(function() { | ||
$div.remove(); | ||
}); | ||
|
||
describe('placeholder text', function() { | ||
it('shows one first letter if one word in a input text', function() { | ||
spyOn($div, 'html'); | ||
$div.imageplaceholder('Seed', 'Name') | ||
expect($div.html).toHaveBeenCalledWith('N'); | ||
}); | ||
|
||
it('shows two first letters if two words in a input text', function() { | ||
spyOn($div, 'html'); | ||
$div.imageplaceholder('Seed', 'First Second') | ||
expect($div.html).toHaveBeenCalledWith('FS'); | ||
}); | ||
|
||
it('shows two first letters if more then two words in a input text', function() { | ||
spyOn($div, 'html'); | ||
$div.imageplaceholder('Seed', 'First Second Middle') | ||
expect($div.html).toHaveBeenCalledWith('FS'); | ||
}); | ||
}); | ||
}); |
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