Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('Should provide suggestions', async function () {
Project.isTitaniumApp = true;
sandbox.stub(tce.completion, 'loadCompletions').resolves(completions);
initTextEditor('Alloy.');
const suggestions = await getSuggestions('Alloy.');
expect(suggestions.length).to.equal(16);
expect(suggestions[0].type).to.equal('method');
expect(suggestions[0].displayText).to.equal('Alloy');
expect(suggestions[0].text).to.equal('Alloy');
expect(suggestions[0].api).to.equal('Alloy');
expect(suggestions[0].replacementPrefix).to.equal('Alloy.');
expect(suggestions[1].type).to.equal('properties');
expect(suggestions[1].displayText).to.equal('Alloy.CFG');
expect(suggestions[1].rightLabel).to.equal('Alloy');
expect(suggestions[1].snippet).to.equal('CFG');
it('Should provide suggestions', async function () {
Project.isTitaniumApp = true;
sandbox.stub(tce.completion, 'loadCompletions').resolves(completions);
initTextEditor('Ti.');
const suggestions = await getSuggestions('Ti.');
expect(suggestions.length).to.equal(202);
expect(suggestions[0].type).to.equal('method');
expect(suggestions[0].text).to.equal('Ti.UI');
expect(suggestions[0].api).to.equal('Ti');
expect(suggestions[0].replacementPrefix).to.equal('Ti.');
expect(suggestions[1].type).to.equal('method');
expect(suggestions[1].text).to.equal('Ti.XML');
expect(suggestions[1].api).to.equal('Ti');
expect(suggestions[1].replacementPrefix).to.equal('Ti.');
it('should provide tag suggestions', async function () {
Project.isTitaniumApp = true;
sandbox.stub(tce.completion, 'loadCompletions').resolves(completions);
initTextEditor('$2');
expect(suggestions[0].rightLabel).to.equal('Alloy.Widget');
expect(suggestions[0].description).to.equal('Alloy.Widget');
expect(suggestions[0].descriptionMoreURL).to.equal('http://docs.appcelerator.com/platform/latest/#!/api/Alloy.Widget');
expect(suggestions[1].type).to.equal('tag');
expect(suggestions[1].displayText).to.equal('Window');
expect(suggestions[1].snippet).to.equal('Window$1>$2');
it('should provide tag suggestions', async function () {
Project.isTitaniumApp = true;
sandbox.stub(tce.completion, 'loadCompletions').resolves(completions);
initTextEditor('"W');
const suggestions = await getSuggestions('W');
expect(suggestions.length).to.equal(4);
expect(suggestions[0].type).to.equal('tag');
expect(suggestions[0].text).to.equal('Widget');
expect(suggestions[0].rightLabel).to.equal('Alloy.Widget');
expect(suggestions[0].description).to.equal('Alloy.Widget');
expect(suggestions[0].descriptionMoreURL).to.equal('http://docs.appcelerator.com/platform/latest/#!/api/Alloy.Widget');
expect(suggestions[1].type).to.equal('tag');
expect(suggestions[1].text).to.equal('Window');
expect(suggestions[1].rightLabel).to.equal('Ti.UI.Window');
expect(suggestions[1].description).to.equal('Ti.UI.Window: The Window is an empty drawing surface or container.');
it('should provide property suggestions', async function () {
Project.isTitaniumApp = true;
sandbox.stub(tce.completion, 'loadCompletions').resolves(completions);
initTextEditor('
it('should provide property name suggestions', async function () {
Project.isTitaniumApp = true;
sandbox.stub(tce.completion, 'loadCompletions').resolves(completions);
initTextEditor('"#id":{s');
const suggestions = await getSuggestions('s');
expect(suggestions[0].type).to.equal('property');
expect(suggestions[0].displayText).to.equal('sys');
expect(suggestions[0].snippet).to.equal('sys: ');
expect(suggestions[1].type).to.equal('property');
expect(suggestions[1].displayText).to.equal('style');
expect(suggestions[1].snippet).to.equal('style: ');
expect(suggestions[2].type).to.equal('property');
expect(suggestions[2].displayText).to.equal('scale');
expect(suggestions[2].snippet).to.equal('scale: ');
});