2048: Tweaks before production (#4027)

* Added additional trigger.

* Fixed container placement / alignment.

* Updated tests.

* Add async start.

* Revert "Add async start."

This reverts commit 54b3edb88221051393d818ccff35d9ae45d10049.

* Check for mobile device and return before onShow

* Ensure we return value from DDH.failed

* remove trailing spaces
master
PJ Hampton 2017-06-05 21:49:57 +01:00 committed by Zaahir Moolla
parent 8c5ac1d651
commit 6d9896cb8b
5 changed files with 38 additions and 22 deletions

View File

@ -5,7 +5,7 @@ use DDG::Goodie;
zci answer_type => "2048"; zci answer_type => "2048";
zci is_cached => 1; zci is_cached => 1;
triggers start => "play 2048", "game 2048"; triggers start => "2048", "play 2048", "game 2048";
handle query_lc => sub { handle query_lc => sub {

View File

@ -1,5 +1,6 @@
<div class="game2048__container"> <div class="game2048__container">
<div id="game2048__area_container"> <div id="game2048__area_container">
<div class="game2048__message"> <div class="game2048__message">
<p></p> <p></p>
@ -11,7 +12,6 @@
</table> </table>
</div> </div>
<div class="game2048__info"> <div class="game2048__info">
<div class="game2048__counter"> <div class="game2048__counter">
<div class="game2048__points_addition"></div> <div class="game2048__points_addition"></div>
@ -24,4 +24,5 @@
<button class="game2048__new_game">New Game</button> <button class="game2048__new_game">New Game</button>
</div> </div>
</div> </div>

View File

@ -113,7 +113,7 @@
.zci--game2048 .game2048__info { .zci--game2048 .game2048__info {
float: right; float: right;
width: 40%; width: 35%;
} }
.zci--game2048 .game2048__help { .zci--game2048 .game2048__help {

View File

@ -3,6 +3,11 @@ DDH.game2048 = DDH.game2048 || {};
DDH.game2048.build = function(ops) { DDH.game2048.build = function(ops) {
"use strict"; "use strict";
//Hide this goodie on mobile devices for now
if (DDG.device.isMobile || DDG.device.isMobileDevice) {
return DDH.failed('game2048');
}
// Global Variables Declaration // Global Variables Declaration
var WINNUM = 2048, var WINNUM = 2048,
SIZE = 4, SIZE = 4,
@ -316,12 +321,6 @@ DDH.game2048.build = function(ops) {
return { return {
onShow: function() { onShow: function() {
//Hide this goodie on mobile devices for now
if(DDG.device.isMobile || DDG.device.isMobileDevice) {
DDH.spice_tabs.game2048.hideLink();
DDH.spice_tabs.game2048.hide();
return;
}
//'started' is a boolean variable used in order to avoid the //'started' is a boolean variable used in order to avoid the
//duplication of the gaming tiles. Moving around the DDG tabs the //duplication of the gaming tiles. Moving around the DDG tabs the

View File

@ -12,6 +12,19 @@ zci is_cached => 1;
ddg_goodie_test( ddg_goodie_test(
[qw( DDG::Goodie::Game2048 )], [qw( DDG::Goodie::Game2048 )],
'2048' => test_zci(
'',
structured_answer => {
data => ignore(),
templates => {
group => "text",
item => 0,
options => {
content => "DDH.game2048.content"
},
}
}
),
'play 2048' => test_zci( 'play 2048' => test_zci(
'', '',
structured_answer => { structured_answer => {
@ -25,7 +38,10 @@ ddg_goodie_test(
} }
} }
), ),
'2048 online' => undef 'what is 2048?' => undef,
'how to play 2048' => undef,
'204823 34232' => undef
); );
done_testing; done_testing;