आप कोणीय निर्देश परीक्षण में कोई विकल्प कैसे चुनते हैं?कोणीय निर्देश परीक्षण विकल्प
var options = elem.find('#test-code-select option');
expect(angular.element(options[0]).text()).to.equal('234');
expect(angular.element(options[1]).text()).to.equal('236');
ये काम ठीक है, लेकिन मैं मैन्युअल रूप से किसी विकल्प के चयन को कैसे बल दूं?
angular.element(options[1]).click(); //nope
angular.element(options[1]).trigger('click'); //nope
angular.element(options[1]).attr('selected', true); //nope
संपादित करें:
निर्देश टेम्पलेट एक आंतरिक एनजी-मॉडल के साथ एक का चयन भी शामिल है, मुझे लगता है इस समस्या के कारण है:
<select id='test-code-select' ng-options='code as code for code in codeList' ng-model='code'>
आश्चर्यजनक, लेकिन यह काम करता है। आपको निश्चित रूप से बदलने के लिए कॉल की आवश्यकता है()। –