forked from cybrespace/pinafore
		
	compose button is not disabled by default
This commit is contained in:
		
							parent
							
								
									ff9c21d00a
								
							
						
					
					
						commit
						d40befacdb
					
				
					 3 changed files with 9 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -115,8 +115,12 @@
 | 
			
		|||
        let sensitive = media.length && !!contentWarning
 | 
			
		||||
        let realm = this.get('realm')
 | 
			
		||||
        let mediaIds = media.map(_ => _.data.id)
 | 
			
		||||
 | 
			
		||||
        let inReplyTo = realm === 'home' ? null : realm
 | 
			
		||||
        let overLimit = this.get('overLimit')
 | 
			
		||||
 | 
			
		||||
        if (!text || overLimit) {
 | 
			
		||||
          return // do nothing if invalid
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /* no await */ postStatus(realm, text, inReplyTo, mediaIds,
 | 
			
		||||
          sensitive, contentWarning, postPrivacyKey)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,7 +43,7 @@
 | 
			
		|||
  export default {
 | 
			
		||||
    store: () => store,
 | 
			
		||||
    computed: {
 | 
			
		||||
      disabled: ($postingStatus, overLimit, length) => $postingStatus || overLimit || length === 0
 | 
			
		||||
      disabled: ($postingStatus, overLimit) => $postingStatus || overLimit
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
</script>
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,7 @@ test('shows compose limits', async t => {
 | 
			
		|||
  await t.useRole(foobarRole)
 | 
			
		||||
    .hover(composeInput)
 | 
			
		||||
    .expect(composeLengthIndicator.innerText).eql('500')
 | 
			
		||||
    .expect(composeButton.getAttribute('disabled')).eql('')
 | 
			
		||||
    .expect(composeButton.hasAttribute('disabled')).notOk()
 | 
			
		||||
    .typeText(composeInput, 'typing some text')
 | 
			
		||||
    .expect(composeLengthIndicator.innerText).eql('484')
 | 
			
		||||
    .expect(composeButton.hasAttribute('disabled')).notOk()
 | 
			
		||||
| 
						 | 
				
			
			@ -33,13 +33,13 @@ test('shows compose limits', async t => {
 | 
			
		|||
    .pressKey('delete')
 | 
			
		||||
    .expect(composeInput.value).eql('')
 | 
			
		||||
    .expect(composeLengthIndicator.innerText).eql('500')
 | 
			
		||||
    .expect(composeButton.getAttribute('disabled')).eql('')
 | 
			
		||||
    .expect(composeButton.hasAttribute('disabled')).notOk()
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
test('shows compose limits for URLs/handles', async t => {
 | 
			
		||||
  await t.useRole(foobarRole)
 | 
			
		||||
    .expect(composeLengthIndicator.innerText).eql('500')
 | 
			
		||||
    .expect(composeButton.getAttribute('disabled')).eql('')
 | 
			
		||||
    .expect(composeButton.hasAttribute('disabled')).notOk()
 | 
			
		||||
    .typeText(composeInput, 'hello world ' +
 | 
			
		||||
      'http://foo.bar.baz.whatever.example.com/hello ' +
 | 
			
		||||
      '@reallylongnamethatstretchesonandon@foo.example.com', {paste: true})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue