Skip to content

Commit

Permalink
Should launch in fullscreen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
rjcorwin committed Mar 9, 2022
1 parent 119a080 commit cb88eab
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tangy-form-reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ const tangyFormReducer = function (state = initialState, action) {
if (newState.form.hideClosedItems === true) newState.items.forEach(item => item.hidden = !item.open)
if (newState.form.linearMode === true) newState.items.forEach(item => item.hideButtons = true)
if (newState.form.fullscreen === true) newState.items.forEach(item => item.fullscreen = true)
if (newState.form.fullscreenOnly === true) {
newState.form.fullscreen = true
newState.items.forEach(item => item.fullscreenOnly = true)
newState.items.forEach(item => item.fullscreenEnabled = true)
}
return newState

case 'OPEN_ALL_ITEMS':
Expand Down
5 changes: 5 additions & 0 deletions tangy-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ export class TangyForm extends PolymerElement {

static get properties() {
return {
fullscreenOnly: {
type: Boolean,
value: false,
reflectToAttribute: true
},
fullscreen: {
type: Boolean,
value: false,
Expand Down
22 changes: 22 additions & 0 deletions test/tangy-form_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,21 @@
</template>
</test-fixture>

<test-fixture id="FullscreenOnly">
<template>
<tangy-form
id="FullscreenOnlyForm"
fullscreen-only
>
<tangy-form-item id="item1" title="1">
<tangy-input name="input1" label="What is your last name?"></tangy-input>
</tangy-form-item>
<tangy-form-item id="item2" title="2">
<tangy-input name="input2" label="What is your last name?"></tangy-input>
</tangy-form-item>
</tangy-form>
</template>
</test-fixture>

<script type="module">
import * as Polymer from '../node_modules/@polymer/polymer/polymer-legacy.js'
Expand All @@ -349,6 +364,13 @@

suite('tangy-form', () => {

test('should launch in fullscreen mode', () => {
const element = fixture('FullscreenOnly')
element.newResponse()
element.querySelector('#item1').shadowRoot.querySelector('dom-if').render()
assert.equal(element.querySelector('#item1').getAttribute('fullscreen-enabled'), '')
})

test('should inject variable', () => {
var someInjectedVariable = {
itWorked: function() {
Expand Down

0 comments on commit cb88eab

Please sign in to comment.