Comparing version 7.2.0 to 7.3.0
{ | ||
"name": "tal", | ||
"version": "7.2.0", | ||
"version": "7.3.0", | ||
"homepage": "http://fmtvp.github.io/tal/index.html", | ||
@@ -5,0 +5,0 @@ "description": "TAL was developed internally within the BBC as a way of vastly simplifying TV application development whilst increasing the reach of BBC TV applications such as iPlayer. Today all of the BBC’s HTML-based TV applications are built using TAL.", |
{ | ||
"name": "tal", | ||
"license": "Apache-2.0", | ||
"version": "7.2.0", | ||
"version": "7.3.0", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -427,2 +427,103 @@ /** | ||
this.KeyboardTest.prototype.testKeyboardModalityHorizontal = function (queue) { | ||
expectAsserts(1); | ||
queuedApplicationInit( | ||
queue, | ||
'lib/mockapplication', | ||
['antie/widgets/keyboard', 'antie/widgets/grid', 'antie/events/keyevent'], | ||
function(application, Keyboard, Grid, KeyEvent) { | ||
var keyboard = new Keyboard('id', 3, 2, ['a', 'b', 'c', | ||
'd', 'e', 'f'], | ||
Grid.WRAP_MODE.HORIZONTAL.ON, | ||
Grid.WRAP_MODE.VERTICAL.OFF); | ||
//a -> b | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_RIGHT)); | ||
//b -> c | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_RIGHT)); | ||
//c -> a | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_RIGHT)); | ||
//a -> b | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_RIGHT)); | ||
assertEquals('b', keyboard.getActiveChildWidget().getChildWidgets()[0].getText()); | ||
}); | ||
}; | ||
this.KeyboardTest.prototype.testKeyboardModalityVertical = function (queue) { | ||
expectAsserts(1); | ||
queuedApplicationInit( | ||
queue, | ||
'lib/mockapplication', | ||
['antie/widgets/keyboard', 'antie/widgets/grid', 'antie/events/keyevent'], | ||
function(application, Keyboard, Grid, KeyEvent) { | ||
var keyboard = new Keyboard('id', 3, 3, ['a', 'b', 'c', | ||
'd', 'e', 'f', | ||
'g', 'h', 'i'], | ||
Grid.WRAP_MODE.HORIZONTAL.OFF, | ||
Grid.WRAP_MODE.VERTICAL.ON); | ||
//a -> d | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_DOWN)); | ||
//d -> g | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_DOWN)); | ||
//g -> a | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_DOWN)); | ||
//a -> d | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_DOWN)); | ||
assertEquals('d', keyboard.getActiveChildWidget().getChildWidgets()[0].getText()); | ||
}); | ||
}; | ||
this.KeyboardTest.prototype.testKeyboardModalityHorizontalVertical = function (queue) { | ||
expectAsserts(1); | ||
queuedApplicationInit( | ||
queue, | ||
'lib/mockapplication', | ||
['antie/widgets/keyboard', 'antie/widgets/grid', 'antie/events/keyevent'], | ||
function(application, Keyboard, Grid, KeyEvent) { | ||
var keyboard = new Keyboard('id', 3, 3, ['a', 'b', 'c', | ||
'd', 'e', 'f', | ||
'g', 'h', 'i'], | ||
Grid.WRAP_MODE.HORIZONTAL.ON, | ||
Grid.WRAP_MODE.VERTICAL.ON); | ||
//a -> d | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_DOWN)); | ||
//d -> g | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_DOWN)); | ||
//g -> a | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_DOWN)); | ||
//a -> d | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_DOWN)); | ||
//d -> e | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_RIGHT)); | ||
//e -> f | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_RIGHT)); | ||
//f -> d | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_RIGHT)); | ||
//d -> e | ||
keyboard.fireEvent(new KeyEvent('keydown', KeyEvent.VK_RIGHT)); | ||
assertEquals('e', keyboard.getActiveChildWidget().getChildWidgets()[0].getText()); | ||
}); | ||
}; | ||
})(); |
@@ -27,2 +27,4 @@ /** | ||
* @param {Integer} rows The number of rows in the grid. | ||
* @param {boolean} horizontalWrapping Enable or disable horizontal wrapping. | ||
* @param {boolean} verticalWrapping Enable or disable vertical wrapping. | ||
*/ | ||
@@ -34,8 +36,12 @@ var Grid = Container.extend(/** @lends antie.widgets.Grid.prototype */ { | ||
*/ | ||
init: function (id, cols, rows) { | ||
init: function (id, cols, rows, horizontalWrapping, verticalWrapping) { | ||
this._super(id); | ||
this.addClass('grid'); | ||
this._cols = cols; | ||
this._rows = rows; | ||
this._horizontalWrapping = !!horizontalWrapping; | ||
this._verticalWrapping = !!verticalWrapping; | ||
this._selectedRow = 0; | ||
@@ -209,9 +215,35 @@ this._selectedCol = 0; | ||
} | ||
if (_newSelectedCol < 0 || _newSelectedCol >= this._cols) { | ||
break; | ||
if (_newSelectedCol < 0) { | ||
if(this._horizontalWrapping) { | ||
_newSelectedCol = this._cols - 1; | ||
} else { | ||
break; | ||
} | ||
} | ||
if (_newSelectedRow < 0 || _newSelectedRow >= this._rows) { | ||
break; | ||
if(_newSelectedCol >= this._cols) { | ||
if(this._horizontalWrapping) { | ||
_newSelectedCol = 0; | ||
} else { | ||
break; | ||
} | ||
} | ||
if (_newSelectedRow < 0) { | ||
if(this._verticalWrapping) { | ||
_newSelectedRow = this._rows - 1; | ||
} else { | ||
break; | ||
} | ||
} | ||
if(_newSelectedRow >= this._rows) { | ||
if(this._verticalWrapping) { | ||
_newSelectedRow = 0; | ||
} else { | ||
break; | ||
} | ||
} | ||
var _newSelectedIndex = (_newSelectedRow * this._cols) + _newSelectedCol; | ||
@@ -250,4 +282,16 @@ var _widget = this._childWidgetOrder[_newSelectedIndex]; | ||
Grid.WRAP_MODE = { | ||
HORIZONTAL: { | ||
ON: 1, | ||
OFF: 0 | ||
}, | ||
VERTICAL: { | ||
ON: 1, | ||
OFF: 0 | ||
} | ||
}; | ||
return Grid; | ||
} | ||
); |
@@ -28,2 +28,4 @@ /** | ||
* @param {String} keys A string of characters which make up the keys, starting top-left and working row-by-row to the bottom-right. | ||
* @param {boolean} horizontalWrapping Enable or disable horizontal wrapping. | ||
* @param {boolean} verticalWrapping Enable or disable vertical wrapping. | ||
* Special characters include: | ||
@@ -39,4 +41,4 @@ * "-" DEL | ||
*/ | ||
init: function(id, cols, rows, keys) { | ||
this._super(id, cols, rows); | ||
init: function(id, cols, rows, keys, horizontalWrapping, verticalWrapping) { | ||
this._super(id, cols, rows, horizontalWrapping, verticalWrapping); | ||
@@ -43,0 +45,0 @@ this.addClass('keyboard'); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5091826
98493