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