// @flow
import React from 'react'
import { shallow } from 'enzyme'

import { resetStyled, expectCSSMatches } from './utils'

let styled

describe('css features', () => {
  beforeEach(() => {
    styled = resetStyled()
  })

  it('should add vendor prefixes in the right order', () => {
    const Comp = styled.div`
      transition: opacity 0.3s;
    `
    shallow(<Comp />)
    expectCSSMatches('.a { -webkit-transition: opacity 0.3s; transition: opacity 0.3s; }')
  })

  it('should add vendor prefixes for display', () => {
    const Comp = styled.div`
      display: flex;
      flex-direction: column;
      align-items: center;
    `
    shallow(<Comp />)
    expectCSSMatches(`
      .a {
        display: -webkit-box;
        display: -moz-box;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
        -webkit-box-direction: normal;
        -webkit-box-orient: vertical;
        -ms-flex-direction: column;
        -webkit-flex-direction: column;
        flex-direction: column;
        -webkit-box-align: center;
        -ms-flex-align: center;
        -webkit-align-items: center;
        align-items: center;
      }
    `)
  })

  it('should handle CSS calc()', () => {
    const Comp = styled.div`
      margin-bottom: calc(15px - 0.5rem) !important;
    `
    shallow(<Comp />)
    expectCSSMatches(`
      .a {
        margin-bottom: -webkit-calc(15px - 0.5rem) !important;
        margin-bottom: -moz-calc(15px - 0.5rem) !important;
        margin-bottom: calc(15px - 0.5rem) !important;
      }
    `)
  })

  it('should pass through custom properties', () => {
    const Comp = styled.div`
      --custom-prop: some-val;
    `
    shallow(<Comp />)
    expectCSSMatches('.a { --custom-prop: some-val; }')
  })
})

@@ -396,24 +396,16 @@
 s('.a %7B 
--webkit-
 transiti
@@ -422,16 +422,24 @@
 y 0.3s; 
+-webkit-
 transiti
@@ -827,24 +827,56 @@
 play: flex;%0A
+        flex-direction: column;%0A
         -web
@@ -1024,38 +1024,35 @@
         
-flex-direction: column
+align-items: center
 ;%0A      
@@ -1153,37 +1153,8 @@
 er;%0A
-        align-items: center;%0A
     

Fix unnecessary test failures