From 734c41b56cd63010b269ef6b6e6247da2f9d656c Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Fri, 25 Mar 2022 17:52:15 +0100 Subject: [PATCH] fix(tests): move to getter/setter (#12441) * fix(tests): move to getter/setter * fix Co-authored-by: Christopher Williams --- tests/Resources/os.test.js | 2 +- tests/Resources/ti.buffer.test.js | 2 +- tests/Resources/ti.codec.test.js | 10 +-- tests/Resources/ti.locale.test.js | 20 ++--- tests/Resources/ti.network.httpclient.test.js | 2 +- tests/Resources/ti.ui.2dmatrix.test.js | 25 +++--- tests/Resources/ti.ui.clipboard.test.js | 48 +++++----- tests/Resources/ti.ui.listview.test.js | 90 +++++++++---------- tests/Resources/ti.ui.matrix2d.test.js | 2 +- tests/Resources/ti.ui.tableview.test.js | 36 ++++---- tests/Resources/ti.ui.webview.test.js | 2 +- 11 files changed, 117 insertions(+), 122 deletions(-) diff --git a/tests/Resources/os.test.js b/tests/Resources/os.test.js index cc3e0aeb228..b27218387e4 100644 --- a/tests/Resources/os.test.js +++ b/tests/Resources/os.test.js @@ -76,7 +76,7 @@ describe('os', function () { it('returns "LE" or "BE", value is consistent with Ti.Codec#getNativeByteOrder()', () => { const byteOrder = os.endianness(); - if (Ti.Codec.getNativeByteOrder() === Ti.Codec.BIG_ENDIAN) { + if (Ti.Codec.nativeByteOrder === Ti.Codec.BIG_ENDIAN) { byteOrder.should.eql('BE'); } else { byteOrder.should.eql('LE'); diff --git a/tests/Resources/ti.buffer.test.js b/tests/Resources/ti.buffer.test.js index 05467f9fa14..b80a3d19ea0 100644 --- a/tests/Resources/ti.buffer.test.js +++ b/tests/Resources/ti.buffer.test.js @@ -629,7 +629,7 @@ describe('Titanium.Buffer', function () { start = 2; } should(buffer.length).eql(length); - should(buffer.byteOrder).eql(Ti.Codec.getNativeByteOrder()); + should(buffer.byteOrder).eql(Ti.Codec.nativeByteOrder); should(buffer[start + 1]).eql(97); // a should(buffer[start + 3]).eql(112); // p should(buffer[start + 5]).eql(112); // p diff --git a/tests/Resources/ti.codec.test.js b/tests/Resources/ti.codec.test.js index ae6fc3be102..3abf2936507 100644 --- a/tests/Resources/ti.codec.test.js +++ b/tests/Resources/ti.codec.test.js @@ -390,7 +390,7 @@ describe('Titanium.Codec', () => { dest: buffer, type: Ti.Codec.TYPE_LONG }); - if (Ti.Codec.getNativeByteOrder() == Ti.Codec.BIG_ENDIAN) { // eslint-disable-line eqeqeq + if (Ti.Codec.nativeByteOrder == Ti.Codec.BIG_ENDIAN) { // eslint-disable-line eqeqeq for (i = 0; i < 3; i++) { should(buffer[i]).eql(0); } @@ -546,13 +546,13 @@ describe('Titanium.Codec', () => { }); }); - describe('#getNativeByteOrder', () => { - it('is a Function', () => { - should(Ti.Codec.getNativeByteOrder).be.a.Function(); + describe('#nativeByteOrder', () => { + it('is a getter', () => { + should(Ti.Codec).have.a.getter('nativeByteOrder'); }); it('returns one of [Ti.Codec.BIG_ENDIAN,Ti.Codec.LITTLE_ENDIAN]', () => { - should([ Ti.Codec.BIG_ENDIAN, Ti.Codec.LITTLE_ENDIAN ]).containEql(Ti.Codec.getNativeByteOrder()); + should([ Ti.Codec.BIG_ENDIAN, Ti.Codec.LITTLE_ENDIAN ]).containEql(Ti.Codec.nativeByteOrder); }); }); diff --git a/tests/Resources/ti.locale.test.js b/tests/Resources/ti.locale.test.js index 03857f4803f..8877a133f6d 100644 --- a/tests/Resources/ti.locale.test.js +++ b/tests/Resources/ti.locale.test.js @@ -16,7 +16,7 @@ describe('Global', () => { describe('Titanium.Locale', () => { // reset back to US english when done - after(() => Ti.Locale.setLanguage('en-US')); + after(() => Ti.Locale.language = 'en-US'); it('exists', () => { should(Ti.Locale).not.be.undefined(); @@ -109,7 +109,7 @@ describe('Titanium.Locale', () => { }); beforeEach(() => { - Ti.Locale.setLanguage('en-US'); + Ti.Locale.language = 'en-US'; }); it('returns stored value for found key', () => { @@ -137,14 +137,14 @@ describe('Titanium.Locale', () => { // https://jira.appcelerator.org/browse/TIMOB-26651 it('handles locale/country specific languages (i.e. en-GB vs en-US)', () => { - Ti.Locale.setLanguage('en-GB'); + Ti.Locale.language = 'en-GB'; should(Ti.Locale.getString('this_is_my_key')).eql('this is my en-GB value'); // This fails on Windows, gives 'this is my value' should(L('this_is_my_key')).eql('this is my en-GB value'); // This fails on Windows, gives 'this is my value' }); // and then this one fails because it's using en-GB strings after we tell it to be ja... it('handles single segment language (i.e. ja)', () => { - Ti.Locale.setLanguage('ja'); + Ti.Locale.language = 'ja'; should(Ti.Locale.getString('this_is_my_key')).eql('これは私の値です'); should(L('this_is_my_key')).eql('これは私の値です'); }); @@ -278,21 +278,21 @@ describe('Titanium.Locale', () => { }); }); - describe('#setLanguage(String)', () => { - it('is a Function', () => { - should(Ti.Locale.setLanguage).be.a.Function(); + describe('#set language(String)', () => { + it('has a setter', () => { + should(Ti.Locale).have.a.setter('language'); }); it('changes .currentLanguage', () => { - Ti.Locale.setLanguage('fr'); + Ti.Locale.language = 'fr'; should(Ti.Locale.currentLanguage).eql('fr'); }); // FIXME Get working on iOS, setLangauge doesn't seem to affect currentLocale it.iosBroken('changes .currentLocale', () => { - Ti.Locale.setLanguage('en-GB'); + Ti.Locale.language = 'en-GB'; should(Ti.Locale.currentLocale).eql('en-GB'); // iOS returns 'en-US' - Ti.Locale.setLanguage('fr'); + Ti.Locale.language = 'fr'; should(Ti.Locale.currentLocale).eql('fr'); }); diff --git a/tests/Resources/ti.network.httpclient.test.js b/tests/Resources/ti.network.httpclient.test.js index 7e796fe08ef..016aef804e6 100644 --- a/tests/Resources/ti.network.httpclient.test.js +++ b/tests/Resources/ti.network.httpclient.test.js @@ -222,7 +222,7 @@ describe('Titanium.Network.HTTPClient', function () { }); xhr.onload = function () { try { - const allHeaders = xhr.getAllResponseHeaders(); + const allHeaders = xhr.allResponseHeaders; should(allHeaders.toLowerCase().indexOf('server:')).be.within(0, 1 / 0); const header = xhr.getResponseHeader('Server'); should(header.length).be.greaterThan(0); diff --git a/tests/Resources/ti.ui.2dmatrix.test.js b/tests/Resources/ti.ui.2dmatrix.test.js index 58aaaa66364..12f706dc098 100644 --- a/tests/Resources/ti.ui.2dmatrix.test.js +++ b/tests/Resources/ti.ui.2dmatrix.test.js @@ -11,21 +11,16 @@ const should = require('./utilities/assertions'); const utilities = require('./utilities/utilities'); -// FIXME: We're moving the name to Ti.UI.Matrix2D now! -describe('Titanium.UI.2DMatrix', function () { +describe('Titanium.UI.Matrix2D', function () { it('apiName', function () { - const matrix = Ti.UI.create2DMatrix(); + const matrix = Ti.UI.createMatrix2D(); should(matrix).have.readOnlyProperty('apiName').which.is.a.String(); - if (utilities.isWindows()) { - should(matrix.apiName).be.eql('Ti.UI.Matrix2D'); - } else { - should(matrix.apiName).be.eql('Ti.UI.2DMatrix'); - } + should(matrix.apiName).be.eql('Ti.UI.Matrix2D'); }); it('#invert()', function () { - var matrix1 = Ti.UI.create2DMatrix(); - var matrix2 = Ti.UI.create2DMatrix(); + var matrix1 = Ti.UI.createMatrix2D(); + var matrix2 = Ti.UI.createMatrix2D(); should(matrix1.invert()).be.an.Object(); matrix1 = matrix1.scale(2, 2); should(matrix1.invert()).be.an.Object(); @@ -38,8 +33,8 @@ describe('Titanium.UI.2DMatrix', function () { }); it('#multiply()', function () { - var matrix1 = Ti.UI.create2DMatrix(); - var matrix2 = Ti.UI.create2DMatrix(); + var matrix1 = Ti.UI.createMatrix2D(); + var matrix2 = Ti.UI.createMatrix2D(); should(matrix1.multiply(matrix2)).be.an.Object(); should(matrix1.multiply(matrix1)).be.an.Object(); if (utilities.isAndroid()) { @@ -60,7 +55,7 @@ describe('Titanium.UI.2DMatrix', function () { }); it('#rotate()', function () { - var matrix1 = Ti.UI.create2DMatrix(); + var matrix1 = Ti.UI.createMatrix2D(); should(matrix1.rotate(0)).be.an.Object(); should(matrix1.rotate(90)).be.an.Object(); should(matrix1.rotate(360)).be.an.Object(); @@ -70,14 +65,14 @@ describe('Titanium.UI.2DMatrix', function () { }); it('#scale()', function () { - var matrix1 = Ti.UI.create2DMatrix(); + var matrix1 = Ti.UI.createMatrix2D(); should(matrix1.scale(50, 50)).be.an.Object(); should(matrix1.scale(0, -1)).be.an.Object(); should(matrix1.scale(-100, -100)).be.an.Object(); }); it('#translate()', function () { - var matrix1 = Ti.UI.create2DMatrix(); + var matrix1 = Ti.UI.createMatrix2D(); should(matrix1.translate(-1, 0)).be.an.Object(); should(matrix1.translate(50, 50)).be.an.Object(); should(matrix1.translate(0, -1)).be.an.Object(); diff --git a/tests/Resources/ti.ui.clipboard.test.js b/tests/Resources/ti.ui.clipboard.test.js index 8e8c02d105e..90bf997b288 100644 --- a/tests/Resources/ti.ui.clipboard.test.js +++ b/tests/Resources/ti.ui.clipboard.test.js @@ -54,7 +54,7 @@ describe('Titanium.UI.Clipboard', () => { it('clears \'text\' data type', () => { Ti.UI.Clipboard.clearData(); // delete all data - Ti.UI.Clipboard.setText('clearData'); + Ti.UI.Clipboard.text = 'clearData'; should(Ti.UI.Clipboard.hasText()).be.true(); Ti.UI.Clipboard.clearData('text'); should(Ti.UI.Clipboard.hasText()).be.false(); @@ -78,7 +78,7 @@ describe('Titanium.UI.Clipboard', () => { it('makes hasText() return false after being called', () => { Ti.UI.Clipboard.clearData(); // delete all data - Ti.UI.Clipboard.setText('clearText'); + Ti.UI.Clipboard.text = 'clearText'; should(Ti.UI.Clipboard.hasText()).be.true(); Ti.UI.Clipboard.clearText(); should(Ti.UI.Clipboard.hasText()).be.false(); @@ -100,7 +100,7 @@ describe('Titanium.UI.Clipboard', () => { it.android('returns null for non-text data type on Android', () => { Ti.UI.Clipboard.clearData(); // delete all data - Ti.UI.Clipboard.setText('hi'); + Ti.UI.Clipboard.text = 'hi'; should(Ti.UI.Clipboard.getData('color')).be.null(); should(Ti.UI.Clipboard.getData('url')).be.null(); should(Ti.UI.Clipboard.getData('image')).be.null(); @@ -146,42 +146,42 @@ describe('Titanium.UI.Clipboard', () => { }); }); - describe('#getText()', () => { - it('is a Function', () => { - should(Ti.UI.Clipboard.getText).be.a.Function(); + describe('#text', () => { + it('is a getter', () => { + should(Ti.UI.Clipboard).have.a.getter('text'); }); it('returns empty string with empty clipboard', () => { Ti.UI.Clipboard.clearData(); // delete all data - // should(Ti.UI.Clipboard.getText()).eql(''); // FIXME: undefined on iOS + // should(Ti.UI.Clipboard.text).eql(''); // FIXME: undefined on iOS }); it('returns given string after setText()', () => { Ti.UI.Clipboard.clearData(); // delete all data - // should(Ti.UI.Clipboard.getText()).eql(''); // FIXME: undefined on iOS - Ti.UI.Clipboard.setText('setText'); - should(Ti.UI.Clipboard.getText()).eql('setText'); + // should(Ti.UI.Clipboard.text).eql(''); // FIXME: undefined on iOS + Ti.UI.Clipboard.text = 'setText'; + should(Ti.UI.Clipboard.text).eql('setText'); }); it('returns given string after setData(\'text\')', () => { Ti.UI.Clipboard.clearData(); // delete all data - // should(Ti.UI.Clipboard.getText()).eql(''); // FIXME: undefined on iOS + // should(Ti.UI.Clipboard.text).eql(''); // FIXME: undefined on iOS Ti.UI.Clipboard.setData('text', 'setData'); - should(Ti.UI.Clipboard.getText()).eql('setData'); + should(Ti.UI.Clipboard.text).eql('setData'); }); it('returns given string after setData(\'text/plain\')', () => { Ti.UI.Clipboard.clearData(); // delete all data - // should(Ti.UI.Clipboard.getText()).eql(''); // FIXME: undefined on iOS + // should(Ti.UI.Clipboard.text).eql(''); // FIXME: undefined on iOS Ti.UI.Clipboard.setData('text/plain', 'setData'); - should(Ti.UI.Clipboard.getText()).eql('setData'); + should(Ti.UI.Clipboard.text).eql('setData'); }); it.ios('returns given string after setData(\'public.plain-text\')', () => { Ti.UI.Clipboard.clearData(); // delete all data - // should(Ti.UI.Clipboard.getText()).eql(''); // FIXME: undefined on iOS + // should(Ti.UI.Clipboard.text).eql(''); // FIXME: undefined on iOS Ti.UI.Clipboard.setData('public.plain-text', 'setData'); - should(Ti.UI.Clipboard.getText()).eql('setData'); + should(Ti.UI.Clipboard.text).eql('setData'); }); }); @@ -232,7 +232,7 @@ describe('Titanium.UI.Clipboard', () => { should(Ti.UI.Clipboard.hasData()).be.false(); should(Ti.UI.Clipboard.hasData('text')).be.false(); should(Ti.UI.Clipboard.hasData('text/plain')).be.false(); - Ti.UI.Clipboard.setText('hello there'); + Ti.UI.Clipboard.text = 'hello there'; should(Ti.UI.Clipboard.hasData()).be.true(); should(Ti.UI.Clipboard.hasData('text')).be.true(); should(Ti.UI.Clipboard.hasData('text/plain')).be.true(); @@ -244,7 +244,7 @@ describe('Titanium.UI.Clipboard', () => { should(Ti.UI.Clipboard.hasData('color')).be.false(); should(Ti.UI.Clipboard.hasData('image')).be.false(); should(Ti.UI.Clipboard.hasData('url')).be.false(); - Ti.UI.Clipboard.setText('hello there'); + Ti.UI.Clipboard.text = 'hello there'; should(Ti.UI.Clipboard.hasData()).be.true(); should(Ti.UI.Clipboard.hasData('text')).be.true(); should(Ti.UI.Clipboard.hasData('text/plain')).be.true(); @@ -294,7 +294,7 @@ describe('Titanium.UI.Clipboard', () => { it('returns true after setText()', () => { Ti.UI.Clipboard.clearData(); // delete all data should(Ti.UI.Clipboard.hasText()).be.false(); - Ti.UI.Clipboard.setText('I set it!'); + Ti.UI.Clipboard.text = 'I set it!'; should(Ti.UI.Clipboard.hasText()).be.true(); }); @@ -437,7 +437,7 @@ describe('Titanium.UI.Clipboard', () => { describe('#setText()', () => { it('is a Function', () => { - should(Ti.UI.Clipboard.setText).be.a.Function(); + should(Ti.UI.Clipboard).have.a.getter('text'); }); // TODO: Test with null/undefined/no arg }); @@ -449,7 +449,7 @@ describe('Titanium.UI.Clipboard', () => { should.not.exist(Ti.UI.Clipboard.getText()); Ti.UI.Clipboard.setText('hello'); should(Ti.UI.Clipboard.hasText()).be.true(); - should(Ti.UI.Clipboard.getText()).eql('hello'); + should(Ti.UI.Clipboard.text).eql('hello'); }); it.ios('Use of named clipboard in iOS', () => { @@ -459,13 +459,13 @@ describe('Titanium.UI.Clipboard', () => { }); should(clipboard1.name).eql('myClipboard'); clipboard1.setText('hello'); - should(clipboard1.getText()).eql('hello'); + should(clipboard1.text).eql('hello'); const clipboard2 = Ti.UI.createClipboard({ name: 'myClipboard' }); - should(clipboard2.getText()).eql('hello'); // same name, so shares the same text + should(clipboard2.text).eql('hello'); // same name, so shares the same text }); it.ios('Use of unique named clipboard in iOS', () => { @@ -477,7 +477,7 @@ describe('Titanium.UI.Clipboard', () => { // Uses a GUID for name should(clipboard.name).match(/[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}/); should(clipboard.unique).be.true(); - should(clipboard.getText()).eql('hello'); + should(clipboard.text).eql('hello'); }); }); }); diff --git a/tests/Resources/ti.ui.listview.test.js b/tests/Resources/ti.ui.listview.test.js index 08901e35a69..2c00feb2cc9 100644 --- a/tests/Resources/ti.ui.listview.test.js +++ b/tests/Resources/ti.ui.listview.test.js @@ -28,10 +28,10 @@ describe('Titanium.UI', () => { should(section_0).be.a.Object(); // Set section items. - section_0.setItems([ + section_0.items = [ { properties: { title: 'Red' } }, { properties: { title: 'White' } } - ]); + ]; should(section_0.items.length).be.eql(2); // Append item to section. @@ -45,11 +45,11 @@ describe('Titanium.UI', () => { should(section_1).be.a.Object(); // Set section items. - section_1.setItems([ + section_1.items = [ { properties: { title: 'Green' } }, { properties: { title: 'Yellow' } }, { properties: { title: 'Blue' } } - ]); + ]; should(section_1.items.length).be.eql(3); // Set listView sections. @@ -189,8 +189,8 @@ describe('Titanium.UI.ListView', function () { win = Ti.UI.createWindow({ backgroundColor: 'green' }); // Set section items. - fruitSection.setItems(fruitDataSet); - vegSection.setItems(vegDataSet); + fruitSection.items = fruitDataSet; + vegSection.items = vegDataSet; // Set header and footer views for first section. fruitSection.headerView = Ti.UI.createView({ backgroundColor: 'black', height: 42 }); @@ -279,22 +279,22 @@ describe('Titanium.UI.ListView', function () { win = Ti.UI.createWindow({ backgroundColor: 'green' }); const fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits' }); - fruitSection.setItems([ + fruitSection.items = [ { properties: { title: 'Apple' } }, { properties: { title: 'Banana' } }, - ]); + ]; const vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables' }); - vegSection.setItems([ + vegSection.items = [ { properties: { title: 'Carrots' } }, { properties: { title: 'Potatoes' } }, - ]); + ]; const fishSection = Ti.UI.createListSection({ headerTitle: 'Fish' }); - fishSection.setItems([ + fishSection.items = [ { properties: { title: 'Cod' } }, { properties: { title: 'Haddock' } }, - ]); + ]; listView.sections = [ fruitSection ]; @@ -352,22 +352,22 @@ describe('Titanium.UI.ListView', function () { win = Ti.UI.createWindow({ backgroundColor: 'green' }); const fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits' }); - fruitSection.setItems([ + fruitSection.items = [ { properties: { title: 'Apple' } }, { properties: { title: 'Banana' } }, - ]); + ]; const vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables' }); - vegSection.setItems([ + vegSection.items = [ { properties: { title: 'Carrots' } }, { properties: { title: 'Potatoes' } }, - ]); + ]; const fishSection = Ti.UI.createListSection({ headerTitle: 'Fish' }); - fishSection.setItems([ + fishSection.items = [ { properties: { title: 'Cod' } }, { properties: { title: 'Haddock' } }, - ]); + ]; listView.sections = [ fruitSection, fishSection ]; @@ -426,22 +426,22 @@ describe('Titanium.UI.ListView', function () { win = Ti.UI.createWindow({ backgroundColor: 'green' }); const fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits' }); - fruitSection.setItems([ + fruitSection.items = [ { properties: { title: 'Apple' } }, { properties: { title: 'Banana' } }, - ]); + ]; const vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables' }); - vegSection.setItems([ + vegSection.items = [ { properties: { title: 'Carrots' } }, { properties: { title: 'Potatoes' } }, - ]); + ]; const fishSection = Ti.UI.createListSection({ headerTitle: 'Fish' }); - fishSection.setItems([ + fishSection.items = [ { properties: { title: 'Cod' } }, { properties: { title: 'Haddock' } }, - ]); + ]; listView.sections = [ fruitSection, fishSection ]; @@ -493,22 +493,22 @@ describe('Titanium.UI.ListView', function () { win = Ti.UI.createWindow({ backgroundColor: 'green' }); const fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits' }); - fruitSection.setItems([ + fruitSection.items = [ { properties: { title: 'Apple' } }, { properties: { title: 'Banana' } }, - ]); + ]; const vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables' }); - vegSection.setItems([ + vegSection.items = [ { properties: { title: 'Carrots' } }, { properties: { title: 'Potatoes' } }, - ]); + ]; const fishSection = Ti.UI.createListSection({ headerTitle: 'Fish' }); - fishSection.setItems([ + fishSection.items = [ { properties: { title: 'Cod' } }, { properties: { title: 'Haddock' } }, - ]); + ]; listView.sections = [ fruitSection, vegSection, fishSection ]; @@ -586,18 +586,18 @@ describe('Titanium.UI.ListView', function () { ukHeaderView.add(Ti.UI.createLabel({ text: 'English UK Header', color: 'white' })); ukFooterView.add(Ti.UI.createLabel({ text: 'English UK Footer', color: 'white' })); - ukSection.setItems([ + ukSection.items = [ { properties: { title: 'Lift', color: 'black' } }, { properties: { title: 'Lorry', color: 'black' } }, { properties: { title: 'Motorway', color: 'black' } } - ]); + ]; listView.appendSection(ukSection); - usSection.setItems([ + usSection.items = [ { properties: { title: 'Elevator', color: 'black' } }, { properties: { title: 'Truck', color: 'black' } }, { properties: { title: 'Freeway', color: 'black' } } - ]); + ]; listView.appendSection(usSection); win.addEventListener('open', () => { @@ -681,24 +681,24 @@ describe('Titanium.UI.ListView', function () { win = Ti.UI.createWindow({ backgroundColor: 'green' }); const fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits / Frutas' }); - fruitSection.setItems([ + fruitSection.items = [ { info: { text: 'Apple' }, es_info: { text: 'Manzana' }, pic: { image: 'Logo.png' } }, { info: { text: 'Banana' }, es_info: { text: 'Banana' }, pic: { image: 'Logo.png' } } - ]); + ]; sections.push(fruitSection); const vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables / Verduras' }); - vegSection.setItems([ + vegSection.items = [ { info: { text: 'Carrot' }, es_info: { text: 'Zanahoria' }, pic: { image: 'Logo.png' } }, { info: { text: 'Potato' }, es_info: { text: 'Patata' }, pic: { image: 'Logo.png' } } - ]); + ]; sections.push(vegSection); const grainSection = Ti.UI.createListSection({ headerTitle: 'Grains / Granos' }); - grainSection.setItems([ + grainSection.items = [ { info: { text: 'Corn' }, es_info: { text: 'Maiz' }, pic: { image: 'Logo.png' } }, { info: { text: 'Rice' }, es_info: { text: 'Arroz' }, pic: { image: 'Logo.png' } } - ]); + ]; sections.push(grainSection); listView.sections = sections; @@ -939,16 +939,16 @@ describe('Titanium.UI.ListView', function () { win = Ti.UI.createWindow({ backgroundColor: 'green' }); const fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits' }); - fruitSection.setItems([ + fruitSection.items = [ { properties: { title: 'Apple', searchableText: 'Apple' } }, { properties: { title: 'Banana', searchableText: 'Banana' } }, - ]); + ]; const vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables' }); - vegSection.setItems([ + vegSection.items = [ { properties: { title: 'Carrots', searchableText: 'Carrots' } }, { properties: { title: 'Potatoes', searchableText: 'Potatoes' } }, - ]); + ]; listView.sections = [ fruitSection, vegSection ]; @@ -1111,7 +1111,7 @@ describe('Titanium.UI.ListView', function () { backgroundColor: 'gray' }); - section.setItems(items); + section.items = items; listView.sections = [ section ]; win.addEventListener('open', () => { diff --git a/tests/Resources/ti.ui.matrix2d.test.js b/tests/Resources/ti.ui.matrix2d.test.js index 0f4803fbc2c..a4b0d971a49 100644 --- a/tests/Resources/ti.ui.matrix2d.test.js +++ b/tests/Resources/ti.ui.matrix2d.test.js @@ -15,7 +15,7 @@ describe('Titanium.UI.Matrix2D', function () { it.iosBroken('apiName', function () { var matrix = Ti.UI.createMatrix2D(); should(matrix).have.readOnlyProperty('apiName').which.is.a.String(); - should(matrix.apiName).be.eql('Ti.UI.Matrix2D'); // ios still reports Ti.UI.2DMatrix + should(matrix.apiName).be.eql('Ti.UI.2DMatrix'); // ios still reports Ti.UI.2DMatrix }); it('#invert()', function () { diff --git a/tests/Resources/ti.ui.tableview.test.js b/tests/Resources/ti.ui.tableview.test.js index 225482cd7a9..da3eef3a66a 100644 --- a/tests/Resources/ti.ui.tableview.test.js +++ b/tests/Resources/ti.ui.tableview.test.js @@ -1079,11 +1079,11 @@ describe('Titanium.UI.TableView', function () { try { tableView.data = []; - tableView.setData(data_a); + tableView.data = data_a; tableView.data = []; - tableView.setData(data_b); + tableView.data = data_b; tableView.data = []; - tableView.setData(data_a); + tableView.data = data_a; } catch (e) { finish(e); } @@ -1419,7 +1419,7 @@ describe('Titanium.UI.TableView', function () { row.add(view); - tableView.setData([ row ]); + tableView.data = [ row ]; tableView.addEventListener('postlayout', function onPostLayout() { console.log('postlayout', row.rect.height, view.rect.height); @@ -1455,7 +1455,7 @@ describe('Titanium.UI.TableView', function () { row.add(view); - tableView.setData([ row ]); + tableView.data = [ row ]; // FIXME: Times out on ios? row.addEventListener('postlayout', () => { @@ -1546,7 +1546,7 @@ describe('Titanium.UI.TableView', function () { backgroundColor: 'blue' }); - tableView.setData([ row ]); + tableView.data = [ row ]; view.add(tableView); @@ -1574,7 +1574,7 @@ describe('Titanium.UI.TableView', function () { backgroundColor: 'blue' }); - tableView.setData([ row ]); + tableView.data = [ row ]; view.add(tableView); @@ -1597,11 +1597,11 @@ describe('Titanium.UI.TableView', function () { backgroundColor: 'white' }); - tableView.setData([ + tableView.data = [ { hasCheck: true }, { hasChild: true }, { hasDetail: true } - ]); + ]; view.add(tableView); @@ -1627,13 +1627,13 @@ describe('Titanium.UI.TableView', function () { backgroundColor: 'white' }); - tableView.setData([ + tableView.data = [ { backgroundColor: 'blue', height: '64px', borderRadius: '16px' } - ]); + ]; view.add(tableView); @@ -1656,12 +1656,12 @@ describe('Titanium.UI.TableView', function () { backgroundColor: 'blue' }); - tableView.setData([ + tableView.data = [ { title: 'Default Title', image: '/Logo.png' } - ]); + ]; view.add(tableView); @@ -1688,7 +1688,7 @@ describe('Titanium.UI.TableView', function () { backgroundColor: 'white' }); - tableView.setData([ { title: 'Row', color: 'black' } ]); + tableView.data = [ { title: 'Row', color: 'black' } ]; view.add(tableView); @@ -1725,7 +1725,7 @@ describe('Titanium.UI.TableView', function () { backgroundColor: 'white' }); - tableView.setData([ { title: 'Row', color: 'black' } ]); + tableView.data = [ { title: 'Row', color: 'black' } ]; view.add(tableView); @@ -1765,12 +1765,12 @@ describe('Titanium.UI.TableView', function () { backgroundColor: 'white' }); - tableView.setData([ + tableView.data = [ Ti.UI.createTableViewSection({ headerTitle: 'TableViewSection.headerTitle', footerTitle: 'TableViewSection.footerTitle' }) - ]); + ]; view.add(tableView); @@ -1804,7 +1804,7 @@ describe('Titanium.UI.TableView', function () { const label = Ti.UI.createLabel({ text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean interdum laoreet augue scelerisque convallis.' }); row.add(label); - tableView.setData([ row ]); + tableView.data = [ row ]; view.add(tableView); diff --git a/tests/Resources/ti.ui.webview.test.js b/tests/Resources/ti.ui.webview.test.js index 291abcdadee..7e9a7ee2ee7 100644 --- a/tests/Resources/ti.ui.webview.test.js +++ b/tests/Resources/ti.ui.webview.test.js @@ -494,7 +494,7 @@ describe('Titanium.UI.WebView', function () { win = Ti.UI.createWindow(); const webView = Ti.UI.createWebView({ url: 'https://google.com', - blacklistedURLs: [ 'https://google.com' ] + blockedURLs: [ 'https://google.com' ] }); webView.addEventListener('blacklisturl', function () {