Commit 21759b79de82cfce744209df7a524b0151ff0709

Authored by Gabriela Navarro
1 parent 208ec37b

Fix JS that was trying to return something null

Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
features/article_visualization.feature 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +Feature: article visualization
  2 + As a user
  3 + I want to change view modes
  4 + In order to see articles in fullscreen or not in fullscreen
  5 +
  6 + Background:
  7 + Given the following users
  8 + | login | name |
  9 + | joaosilva | Joao Silva |
  10 + And "joaosilva" has no articles
  11 + And the following articles
  12 + | owner | name | body |
  13 + | joaosilva | Sample Article | This is an article |
  14 + And I am logged in as "joaosilva"
  15 +
  16 + @selenium
  17 + Scenario: viewing the article in fullscreen by default
  18 + Given I go to /joaosilva/sample-article?fullscreen=1
  19 + Then I should see "Exit full screen"
  20 +
  21 + @selenium
  22 + Scenario: viewing the article not in fullscreen by default
  23 + Given I go to /joaosilva/sample-article
  24 + Then I should see "Full screen"
  25 +
  26 + @selenium
  27 + Scenario: changing the view mode from not in fullscreen to fullscreen
  28 + Given I go to /joaosilva/sample-article
  29 + And I follow "Full screen"
  30 + Then I should see "Exit full screen"
... ...
public/javascripts/application.js
... ... @@ -1178,7 +1178,10 @@ window.isHidden = function isHidden() { return (typeof(document.hidden) != &#39;unde
1178 1178  
1179 1179 function $_GET(id){
1180 1180 var a = new RegExp(id+"=([^&#=]*)");
1181   - return decodeURIComponent(a.exec(window.location.search)[1]);
  1181 + var result_of_search = a.exec(window.location.search)
  1182 + if(result_of_search != null){
  1183 + return decodeURIComponent(result_of_search[1]);
  1184 + }
1182 1185 }
1183 1186  
1184 1187 var fullwidth=false;
... ... @@ -1206,4 +1209,3 @@ function fullscreenPageLoad(itemId){
1206 1209 }
1207 1210 });
1208 1211 }
1209   -
... ...