mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
02e924e3c5
commit
05b25af69f
55 changed files with 1554 additions and 907 deletions
|
@ -196,23 +196,51 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
input = fixture('basic');
|
||||
});
|
||||
|
||||
test('focus/blur events fired on host element', function() {
|
||||
var nFocusEvents = 0;
|
||||
var nBlurEvents = 0;
|
||||
// At the moment, it is very hard to correctly fire exactly
|
||||
// one focus/blur events on a paper-input. This is because
|
||||
// when a paper-input is focused, it needs to focus
|
||||
// its underlying native input, which will also fire a `blur`
|
||||
// event.
|
||||
test('focus events fired on host element', function() {
|
||||
input.addEventListener('focus', function(event) {
|
||||
nFocusEvents += 1;
|
||||
assert(input.focused, 'input is focused');
|
||||
MockInteractions.blur(input.inputElement);
|
||||
});
|
||||
input.addEventListener('blur', function() {
|
||||
nBlurEvents += 1;
|
||||
assert(!input.focused, 'input is blurred');
|
||||
});
|
||||
MockInteractions.focus(input.inputElement);
|
||||
assert.isTrue(nFocusEvents >= 1, 'focus event fired');
|
||||
assert.isTrue(nBlurEvents >= 1, 'blur event fired');
|
||||
MockInteractions.focus(input);
|
||||
});
|
||||
|
||||
test('focus events fired on host element if nested element is focused', function() {
|
||||
input.addEventListener('focus', function(event) {
|
||||
assert(input.focused, 'input is focused');
|
||||
});
|
||||
MockInteractions.focus(input.inputElement);
|
||||
});
|
||||
|
||||
test('blur events fired on host element', function() {
|
||||
MockInteractions.focus(input);
|
||||
input.addEventListener('blur', function(event) {
|
||||
assert(!input.focused, 'input is blurred');
|
||||
});
|
||||
MockInteractions.blur(input);
|
||||
});
|
||||
|
||||
test('blur events fired on host element nested element is blurred', function() {
|
||||
MockInteractions.focus(input);
|
||||
input.addEventListener('blur', function(event) {
|
||||
assert(!input.focused, 'input is blurred');
|
||||
});
|
||||
MockInteractions.blur(input.inputElement);
|
||||
});
|
||||
|
||||
test('focusing then bluring sets the focused attribute correctly', function() {
|
||||
MockInteractions.focus(input);
|
||||
assert(input.focused, 'input is focused');
|
||||
MockInteractions.blur(input);
|
||||
assert(!input.focused, 'input is blurred');
|
||||
MockInteractions.focus(input.inputElement);
|
||||
assert(input.focused, 'input is focused');
|
||||
MockInteractions.blur(input.inputElement);
|
||||
assert(!input.focused, 'input is blurred');
|
||||
});
|
||||
});
|
||||
|
||||
suite('focused styling (integration test)', function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue