Merge "Fix editable-label losing focus"
This commit is contained in:
		@@ -92,7 +92,7 @@
 | 
			
		||||
 | 
			
		||||
    _showDropdown() {
 | 
			
		||||
      if (this.readOnly || this.editing) { return; }
 | 
			
		||||
      this._open().then(() => {
 | 
			
		||||
      return this._open().then(() => {
 | 
			
		||||
        this.$.input.$.input.focus();
 | 
			
		||||
        if (!this.$.input.value) { return; }
 | 
			
		||||
        this.$.input.$.input.setSelectionRange(0, this.$.input.value.length);
 | 
			
		||||
@@ -118,7 +118,7 @@
 | 
			
		||||
      let iters = 0;
 | 
			
		||||
      const step = () => {
 | 
			
		||||
        this.async(() => {
 | 
			
		||||
          if (this.style.display !== 'none') {
 | 
			
		||||
          if (this.$.dropdown.style.display !== 'none') {
 | 
			
		||||
            fn.call(this);
 | 
			
		||||
          } else if (iters++ < AWAIT_MAX_ITERS) {
 | 
			
		||||
            step.call(this);
 | 
			
		||||
 
 | 
			
		||||
@@ -77,15 +77,18 @@ limitations under the License.
 | 
			
		||||
      assert.isFalse(element.$.dropdown.opened);
 | 
			
		||||
      assert.isTrue(label.classList.contains('editable'));
 | 
			
		||||
      assert.equal(label.textContent, 'value text');
 | 
			
		||||
      const focusSpy = sandbox.spy(element.$.input.$.input, 'focus');
 | 
			
		||||
      const showSpy = sandbox.spy(element, '_showDropdown');
 | 
			
		||||
 | 
			
		||||
      MockInteractions.tap(label);
 | 
			
		||||
 | 
			
		||||
      Polymer.dom.flush();
 | 
			
		||||
 | 
			
		||||
      return showSpy.lastCall.returnValue.then(() => {
 | 
			
		||||
        // The dropdown is open (which covers up the label):
 | 
			
		||||
        assert.isTrue(element.$.dropdown.opened);
 | 
			
		||||
        assert.isTrue(focusSpy.called);
 | 
			
		||||
        assert.equal(input.value, 'value text');
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('title with placeholder', done => {
 | 
			
		||||
      assert.equal(element.title, 'value text');
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user