Skip to content

Commit

Permalink
Merge branch 'master' into module-template
Browse files Browse the repository at this point in the history
  • Loading branch information
lokeshchdhry committed Sep 17, 2020
2 parents e614749 + 193bbc3 commit 05cb85a
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 86 deletions.
8 changes: 4 additions & 4 deletions build/lib/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,16 @@ class Packager {
const modulesDir = path.join(this.zipDir, 'modules');

// We have a race condition problem where where the top-level modules folder and the platform-specific
// sub-folders are trying to be created at the same time if we copy moduels in parallel
// sub-folders are trying to be created at the same time if we copy modules in parallel
// How can we avoid? Pre-create the common folder structure in advance!
await fs.ensureDir(modulesDir);
await fs.emptyDir(modulesDir);
const subDirs = this.platforms.concat([ 'commonjs' ]);
// Convert ios to iphone
const iosIndex = subDirs.indexOf('ios');
if (iosIndex !== -1) {
subDirs[iosIndex] = 'iphone';
}
await Promise.all(subDirs.map(d => fs.ensureDir(path.join(modulesDir, d))));
await Promise.all(subDirs.map(d => fs.emptyDir(path.join(modulesDir, d))));
// Now download/extract/copy the modules
await Promise.all(modules.map(m => this.handleModule(m)));

Expand Down Expand Up @@ -296,7 +296,7 @@ class Packager {
if (this.targetOS !== 'win32') {
ignoreDirs.push(path.join(SUPPORT_DIR, 'win32'));
}
// FIXME: Usee Array.prototype.some to filter more succinctly
// FIXME: Use Array.prototype.some to filter more succinctly
const filter = src => {
for (const ignore of ignoreDirs) {
if (src.includes(ignore)) {
Expand Down
1 change: 1 addition & 0 deletions build/lib/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ async function addTiAppProperties() {
content.push('\t<property name="presetDouble" type="double">1.23456</property>');
content.push('\t<property name="presetInt" type="int">1337</property>');
content.push('\t<property name="presetString" type="string">Hello!</property>');
content.push(`\t<property name="isCI" type="bool">${isCI}</property>`);
content.push('\t<transpile>true</transpile>');
} else if (line.indexOf('<android xmlns:android') >= 0) {
// Insert manifest
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@
"folder-hash": "^3.3.3",
"glob": "^7.1.6",
"husky": "^4.3.0",
"lint-staged": "^10.3.0",
"lint-staged": "^10.4.0",
"mocha": "^8.1.3",
"mocha-jenkins-reporter": "^0.4.5",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"request-promise-native": "^1.0.9",
"rollup": "^2.26.11",
"rollup": "^2.27.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
Expand Down
44 changes: 22 additions & 22 deletions tests/Resources/ti.filesystem.file.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,15 +569,15 @@ describe('Titanium.Filesystem.File', function () {
}

// write some initial contents
should(fileATxt.write('text initial ')).eql.true;
should(fileATxt.exists()).eql.true;
should(fileATxt.write('text initial ')).be.true();
should(fileATxt.exists()).be.true();

// Now move the file
should(fileATxt.move(destPath)).eql.true;
should(fileATxt.move(destPath)).be.true();

// Now verify that the original file doesn't exist and the new file does
should(fileATxt.exists()).eql.false;
should(dest.exists()).eql.true;
should(fileATxt.exists()).be.false();
should(dest.exists()).be.true();
});

it('moves file to another directory', function () {
Expand All @@ -594,19 +594,19 @@ describe('Titanium.Filesystem.File', function () {
}

if (!subdir.exists()) {
should(subdir.createDirectory()).eql.true;
should(subdir.createDirectory()).be.true();
}

// write some initial contents
should(fileATxt.write('text initial ')).eql.true;
should(fileATxt.exists()).eql.true;
should(fileATxt.write('text initial ')).be.true();
should(fileATxt.exists()).be.true();

// Now move the file
should(fileATxt.move(dest.nativePath)).eql.true;
should(fileATxt.move(dest.nativePath)).be.true();

// Now verify that the original file doesn't exist and the new file does
should(fileATxt.exists()).eql.false;
should(dest.exists()).eql.true;
should(fileATxt.exists()).be.false();
should(dest.exists()).be.true();
});
});

Expand All @@ -630,15 +630,15 @@ describe('Titanium.Filesystem.File', function () {
}

// write some initial contents
should(fileATxt.write('text initial ')).eql.true;
should(fileATxt.exists()).eql.true;
should(fileATxt.write('text initial ')).be.true();
should(fileATxt.exists()).be.true();

// Now rename the file
should(fileATxt.rename(destPath)).eql.true;
should(fileATxt.rename(destPath)).be.true();

// Now verify that the original file doesn't exist and the new file does
should(fileATxt.exists()).eql.false;
should(dest.exists()).eql.true;
should(fileATxt.exists()).be.false();
should(dest.exists()).be.true();
});

it('fails to rename file to another directory', function () {
Expand All @@ -655,19 +655,19 @@ describe('Titanium.Filesystem.File', function () {
}

if (!subdir.exists()) {
should(subdir.createDirectory()).eql.true;
should(subdir.createDirectory()).be.true();
}

// write some initial contents
should(fileATxt.write('text initial ')).eql.true;
should(fileATxt.exists()).eql.true;
should(fileATxt.write('text initial ')).be.true();
should(fileATxt.exists()).be.true();

// Now move the file
should(fileATxt.rename(dest.nativePath)).eql.false;
should(fileATxt.rename(dest.nativePath)).be.false();

// Now verify that the original file still exists and the new file doesn't
should(fileATxt.exists()).eql.true;
should(dest.exists()).eql.false;
should(fileATxt.exists()).be.true();
should(dest.exists()).be.false();
});
});

Expand Down
7 changes: 7 additions & 0 deletions tests/Resources/ti.ui.tabgroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
/* eslint no-unused-expressions: "off" */
'use strict';
const should = require('./utilities/assertions'); // eslint-disable-line no-unused-vars
const utilities = require('./utilities/utilities');

const isCI = Ti.App.Properties.getBool('isCI', false);

describe('Titanium.UI.TabGroup', function () {
this.timeout(5000);
Expand Down Expand Up @@ -58,6 +61,10 @@ describe('Titanium.UI.TabGroup', function () {
});

it.windowsBroken('add Map.View to TabGroup', function (finish) {
if (isCI && utilities.isMacOS()) { // FIXME: On macOS CI (maybe < 10.15.6?), the mapView compelete event never fires! Does app need explicit focus added?
return finish(); // FIXME: skip when we move to official mocha package
}

this.slow(5000);
this.timeout(15000);

Expand Down
7 changes: 7 additions & 0 deletions tests/Resources/ti.ui.tableview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
/* eslint no-unused-expressions: "off" */
'use strict';
const should = require('./utilities/assertions');
const utilities = require('./utilities/utilities');

const isCI = Ti.App.Properties.getBool('isCI', false);

describe('Titanium.UI.TableView', function () {
this.timeout(5000);
Expand Down Expand Up @@ -1385,6 +1388,10 @@ describe('Titanium.UI.TableView', function () {
});

it.ios('row#rect', function (finish) {
if (isCI && utilities.isMacOS()) { // FIXME: On macOS CI (maybe < 10.15.6?), times out! Does app need explicit focus added?
return finish(); // FIXME: skip when we move to official mocha package
}

win = Ti.UI.createWindow();
const tableView = Ti.UI.createTableView();
const row = Ti.UI.createTableViewRow({
Expand Down
63 changes: 33 additions & 30 deletions tests/Resources/ti.ui.textarea.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
/* eslint-env titanium, mocha */
/* eslint no-unused-expressions: "off" */
'use strict';
var should = require('./utilities/assertions');
const should = require('./utilities/assertions');
const utilities = require('./utilities/utilities');

const isCI = Ti.App.Properties.getBool('isCI', false);

describe('Titanium.UI.TextArea', function () {
let win;
Expand All @@ -26,15 +29,15 @@ describe('Titanium.UI.TextArea', function () {
});

it('apiName', function () {
var textArea = Ti.UI.createTextArea({
const textArea = Ti.UI.createTextArea({
value: 'this is some text'
});
should(textArea).have.readOnlyProperty('apiName').which.is.a.String();
should(textArea.apiName).be.eql('Ti.UI.TextArea');
});

it('value', function () {
var textArea = Ti.UI.createTextArea({
const textArea = Ti.UI.createTextArea({
value: 'this is some text'
});
should(textArea.value).be.a.String();
Expand All @@ -47,31 +50,31 @@ describe('Titanium.UI.TextArea', function () {
});

it('editable', function () {
var textArea = Ti.UI.createTextArea();
const textArea = Ti.UI.createTextArea();
should(textArea.editable).be.a.Boolean();
should(textArea.editable).be.true();
textArea.setEditable(false);
should(textArea.editable).be.false();
});

it.ios('scrollsToTop', function () {
var textArea = Ti.UI.createTextArea();
const textArea = Ti.UI.createTextArea();
should(textArea.scrollsToTop).be.a.Boolean();
should(textArea.scrollsToTop).be.true();
textArea.setScrollsToTop(false);
should(textArea.scrollsToTop).be.false();
});

it('backgroundColor', function () {
var textArea = Ti.UI.createTextArea({ backgroundColor: 'red' });
const textArea = Ti.UI.createTextArea({ backgroundColor: 'red' });
should(textArea.backgroundColor).be.a.String();
should(textArea.backgroundColor).eql('red');
textArea.setBackgroundColor('white');
should(textArea.backgroundColor).eql('white');
});

it.windowsMissing('padding', function () {
var textArea = Ti.UI.createTextArea({
const textArea = Ti.UI.createTextArea({
value: 'this is some text',
padding: {
left: 20,
Expand Down Expand Up @@ -100,13 +103,12 @@ describe('Titanium.UI.TextArea', function () {

// Tests adding and removing a TextArea's focus.
it.ios('focus-blur', function (finish) {
var textArea;
this.timeout(5000);
win = Ti.UI.createWindow({ layout: 'vertical' });

// First TextArea is needed to receive default focus on startup
// and to receive focus when second TextArea has lost focus.
textArea = Ti.UI.createTextArea({
let textArea = Ti.UI.createTextArea({
width: Ti.UI.FILL,
height: Ti.UI.SIZE,
});
Expand Down Expand Up @@ -139,7 +141,7 @@ describe('Titanium.UI.TextArea', function () {
});

it.ios('textAlign', function () {
var textArea = Ti.UI.createTextArea({
const textArea = Ti.UI.createTextArea({
value: 'this is some text',
textAlign: Titanium.UI.TEXT_ALIGNMENT_CENTER
});
Expand All @@ -153,7 +155,7 @@ describe('Titanium.UI.TextArea', function () {
});

it.ios('verticalAlign', function () {
var textArea = Ti.UI.createTextArea({
const textArea = Ti.UI.createTextArea({
value: 'this is some text',
verticalAlign: Titanium.UI.TEXT_VERTICAL_ALIGNMENT_BOTTOM
});
Expand All @@ -167,7 +169,7 @@ describe('Titanium.UI.TextArea', function () {
});

it.android('lines', function () {
var textArea = Ti.UI.createTextArea({
const textArea = Ti.UI.createTextArea({
lines: 1,
maxLines: 5
});
Expand All @@ -185,49 +187,50 @@ describe('Titanium.UI.TextArea', function () {

// Tests adding and removing a TextArea's focus.
it('textArea in tabGroup', function (finish) {
var windowA, windowB, tabA, tabB, tabGroup;
if (isCI && utilities.isMacOS()) { // FIXME: On macOS CI (maybe < 10.15.6?), times out! Does app need explicit focus added?
return finish(); // FIXME: skip when we move to official mocha package
}

this.timeout(7500);

windowA = Ti.UI.createWindow();
windowB = Ti.UI.createWindow();

tabA = Ti.UI.createTab({
const windowA = Ti.UI.createWindow();
const tabA = Ti.UI.createTab({
window: windowA,
title: 'Tab A'
});

tabB = Ti.UI.createTab({
const windowB = Ti.UI.createWindow();
const tabB = Ti.UI.createTab({
window: windowB,
title: 'Tab B'
});

tabGroup = Titanium.UI.createTabGroup({
const tabGroup = Titanium.UI.createTabGroup({
tabs: [ tabA, tabB ]
});

windowA.addEventListener('open', function () {
var subwin, typingView, keyboardMessageView, keyboardMessage;

subwin = Ti.UI.createWindow({ backgroundColor: 'blue' });
const subwin = Ti.UI.createWindow({ backgroundColor: 'blue' });

subwin.addEventListener('open', function () {
subwin.close();
tabGroup.close();
try {
subwin.close();
tabGroup.close();
} catch (err) {
return finish(err);
}
finish();
});

typingView = Ti.UI.createView();
keyboardMessageView = Ti.UI.createView();
keyboardMessage = Ti.UI.createTextArea();
const typingView = Ti.UI.createView();
const keyboardMessageView = Ti.UI.createView();
const keyboardMessage = Ti.UI.createTextArea();

keyboardMessageView.add(keyboardMessage);
typingView.add(keyboardMessageView);
subwin.add(typingView);

setTimeout(function () {
tabA.open(subwin);
}, 1000);
setTimeout(() => tabA.open(subwin), 1000);
});

tabGroup.open();
Expand Down

0 comments on commit 05cb85a

Please sign in to comment.