// @flow
import { getStackedRules } from './stacking.css-rules';

describe('stacking', () => {
  describe('getStackedRules', () => {
    it('does not produce rules if not stacked', () => {
      const rules = getStackedRules({});
      expect(rules).toEqual('');
    });

    it('sets flex direction based on how it is stacked', () => {
      const rules = getStackedRules({ stacked: 'column' });
      expect(rules).toContain('flex-direction: column;\n');
    });

    describe('justify', () => {
      it('sets default justify', () => {
        const rules = getStackedRules({ stacked: 'row' });
        expect(rules).toContain(`justify-content: flex-start;\n`);
      });

      it('sets `justifyContent` based on justify value', () => {
        const rules = getStackedRules({ stacked: 'row', justify: 'end' });
        expect(rules).toContain(`justify-content: flex-end;\n`);
      });
    });

    describe('align', () => {
      it('sets default align', () => {
        const rules = getStackedRules({ stacked: 'row' });
        expect(rules).toContain('align-items: stretch;\n');
      });

      it('sets `alignItems` based on align value', () => {
        const rules = getStackedRules({ stacked: 'row', align: 'end' });
        expect(rules).toContain('align-items: flex-end;\n');
      });
    });
  });
});
