-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add "isTrusted" property to Slider "change" event (#11717)
Fixes TIMOB-27977
- Loading branch information
Showing
4 changed files
with
79 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2015-Present by Axway, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
/* eslint-env mocha */ | ||
/* eslint no-unused-expressions: "off" */ | ||
'use strict'; | ||
const should = require('./utilities/assertions'); | ||
|
||
describe('Titanium.UI.Slider', function () { | ||
let win; | ||
|
||
this.timeout(5000); | ||
|
||
afterEach((done) => { | ||
if (win) { | ||
let t = setTimeout(function () { | ||
if (win) { | ||
win = null; | ||
done(); | ||
} | ||
}, 3000); | ||
win.addEventListener('close', function listener () { | ||
clearTimeout(t); | ||
if (win) { | ||
win.removeEventListener('close', listener); | ||
} | ||
win = null; | ||
done(); | ||
}); | ||
win.close(); | ||
} else { | ||
win = null; | ||
done(); | ||
} | ||
}); | ||
|
||
it('change event', (finish) => { | ||
win = Ti.UI.createWindow(); | ||
const slider = Ti.UI.createSlider({ min: 0, max: 100, value: 50 }); | ||
win.add(slider); | ||
win.addEventListener('open', () => { | ||
slider.addEventListener('change', (e) => { | ||
try { | ||
should(e.value).be.a.Number(); | ||
should(e.value).be.eql(75); | ||
should(e.isTrusted).be.a.Boolean(); | ||
should(e.isTrusted).be.false(); | ||
should(e.source).be.eql(slider); | ||
finish(); | ||
} catch (err) { | ||
finish(err); | ||
} | ||
}); | ||
slider.value = 75; | ||
}); | ||
win.open(); | ||
}); | ||
}); |