Sha256: 60424a355786c8ad96449eb614a180cab464069fbc322d946d2f8dcfd7353c0b
Contents?: true
Size: 1.47 KB
Versions: 9
Compression:
Stored size: 1.47 KB
Contents
/* eslint-disable jquery/no-val */ /* eslint-disable jquery/no-is */ import $ from 'jquery'; jest.unmock('jquery'); jest.unmock('./trends'); window.trends = require('./trends'); describe('selecting trend type', () => { it('should disable fields on non-fact trend', () => { document.body.innerHTML = `<select id="trendable_type" onchange="trends.trendTypeSelected(this)"> <option value="FactName">Facts</option> <option value="Hostgroup">Host group</option> </select> <select id="trend_trendable_id"> <option value=""></option> <option value="27">architecture</option> </select> <input id="trend_name">`; $('#trendable_type') .val('Hostgroup') .change(); expect($('#trend_trendable_id').is(':disabled')).toBeTruthy(); expect($('#trend_name').is(':disabled')).toBeTruthy(); }); it('should enable fields on non-fact trend', () => { document.body.innerHTML = `<select id="trendable_type" onchange="trends.trendTypeSelected(this)"> <option value="Evironment">Environment</option> <option value="FactName">Facts</option> </select> <select id="trend_trendable_id" disabled> <option value=""></option> <option value="27">architecture</option> </select> <input id="trend_name" disabled>`; $('#trendable_type') .val('FactName') .change(); expect($('#trend_trendable_id').is(':disabled')).toBeFalsy(); expect($('#trend_name').is(':disabled')).toBeFalsy(); }); });
Version data entries
9 entries across 9 versions & 1 rubygems