test-elements.html 3.66 KB
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../iron-resizable-behavior.html">

<script>

  Polymer({

    is: 'x-resizer-parent',

    behaviors: [
      Polymer.IronResizableBehavior
    ],

    listeners: {
      'core-resize': 'resizeHandler'
    },

    resizeHandler: function() {
    }

  });

</script>

<script>

  Polymer({

    is: 'x-resizer-parent-filtered',

    active: null,

    behaviors: [
      Polymer.IronResizableBehavior
    ],

    listeners: {
      'core-resize': 'resizeHandler'
    },

    resizeHandler: function() {
    },

    resizerShouldNotify: function(el) {
      return (el == this.active);
    }

  });

</script>

<script>

  Polymer({

    is: 'x-resizable',

    behaviors: [
      Polymer.IronResizableBehavior
    ],

    listeners: {
      'core-resize': 'resizeHandler'
    },

    resizeHandler: function() {
    }

  });

</script>

<dom-module id="x-resizable-in-shadow">

  <template>

    <div>
      <x-resizable id="resizable"></x-resizable>
    </div>

  </template>

</dom-module>

<script>

  Polymer({

    is: 'x-resizable-in-shadow'

  });

</script>

<dom-module id='test-element'>

  <template>

    <!-- Normal resizable parent with child resizables -->
    <x-resizer-parent id="parent">
      <x-resizable id="child1a"></x-resizable>
      <div>
        <x-resizable id="child1b"></x-resizable>
      </div>
      <x-resizable-in-shadow id="shadow1c"></x-resizable-in-shadow>
      <div>
        <x-resizable-in-shadow id="shadow1d"></x-resizable-in-shadow>
      </div>
    </x-resizer-parent>

    <!-- Resizable parent using resizerShouldNotify, with child resizables -->
    <x-resizer-parent-filtered id="parentFiltered">
      <x-resizable id="child2a"></x-resizable>
      <div>
        <x-resizable id="child2b"></x-resizable>
      </div>
      <x-resizable-in-shadow id="shadow2c"></x-resizable-in-shadow>
      <div>
        <x-resizable-in-shadow id="shadow2d"></x-resizable-in-shadow>
      </div>
    </x-resizer-parent-filtered>

  </template>

</dom-module>

<script>

  Polymer({

    is: 'test-element'

  });

</script>
<script>
  Polymer.ObserveIronResizeBehavior = {
    properties: {
      ironResizeCount: {
        type: Number,
        value: 0
      }
    },

    listeners: {
      'iron-resize': '_incrementIronResizeCount'
    },

    _incrementIronResizeCount: function() {
      this.ironResizeCount++;
    }
  };
</script>
<dom-module id="x-shadow-resizable">
  <template>
    <div></div>
  </template>
</dom-module>
<script>
  Polymer({
    is: 'x-shadow-resizable',

    behaviors: [
      Polymer.IronResizableBehavior,
      Polymer.ObserveIronResizeBehavior
    ]
  });
</script>

<dom-module id="x-light-resizable">
  <template>
    <x-shadow-resizable id="childResizable1"></x-shadow-resizable>
    <x-shadow-resizable id="childResizable2"></x-shadow-resizable>
  </template>
</dom-module>
<script>
  Polymer({
    is: 'x-light-resizable',

    behaviors: [
      Polymer.IronResizableBehavior,
      Polymer.ObserveIronResizeBehavior
    ]
  });
</script>