diff --git a/js/utils/viewport.js b/js/utils/viewport.js index 3f62d4d21b..806b59b5f8 100644 --- a/js/utils/viewport.js +++ b/js/utils/viewport.js @@ -25,8 +25,10 @@ function viewportLoadTag() { var props = viewportTag.content.toLowerCase().replace(/\s+/g, '').split(','); var keyValue; for(x=0; x 1 ? keyValue[1] : '_'); + } } viewportUpdate(); } @@ -112,12 +114,12 @@ function viewportUpdate() { } } -function viewportTagUpdate(updates) { - ionic.Utils.extend(viewportProperties, updates); - +function viewportTagUpdate() { var key, props = []; for(key in viewportProperties) { - if( viewportProperties[key] ) props.push(key + '=' + viewportProperties[key]); + if( viewportProperties[key] ) { + props.push(key + (viewportProperties[key] == '_' ? '' : '=' + viewportProperties[key]) ); + } } viewportTag.content = props.join(', '); diff --git a/test/unit/utils/viewport.unit.js b/test/unit/utils/viewport.unit.js index ff1b417cfc..99b272fa45 100644 --- a/test/unit/utils/viewport.unit.js +++ b/test/unit/utils/viewport.unit.js @@ -479,6 +479,18 @@ describe('Ionic Viewport', function() { + it('Should set viewport properties that have a key but without a value', function(){ + vportTag.content = ' keyonly, , ,, WIDTH=DeViCe-wIDTH , minimal-ui '; + viewportLoadTag(); + + expect( viewportProperties['keyonly'] ).toEqual('_'); + expect( viewportProperties['width'] ).toEqual('device-width'); + expect( viewportProperties['minimal-ui'] ).toEqual('_'); + + viewportTagUpdate(); + expect( vportTag.content ).toEqual('keyonly, width=device-width, minimal-ui'); + }); + it('Should get portrait (0) orientation', function(){ window.innerWidth = 768; window.innerHeight = 1024;