import PercentFormatter from '../../etc/percent-formatter';

describe('PercentFormatter', function() {
    it('should append percentage sign', function() {
        const formatter = new PercentFormatter(),
            change = {
                proposed: {
                    text: '12'
                }
            };

        expect(formatter.isChangeValid(change)).to.be.true;
        expect(change.proposed.text).to.equal('12%');
    });

    it('should clear single percentage sign', function() {
        const formatter = new PercentFormatter(),
            change = {
                proposed: {
                    text: '%'
                }
            };

        expect(formatter.isChangeValid(change)).to.be.true;
        expect(change.proposed.text).to.equal('');
    });
});
