Пример #1
0
 def test_not_enabled(self):
     handler = CompletionHandler(self.view)
     self.assertFalse(handler.initialized)
     self.assertFalse(handler.enabled)
     result = handler.on_query_completions("", [0])
     self.assertTrue(handler.initialized)
     self.assertFalse(handler.enabled)
     self.assertIsNone(result)
Пример #2
0
 def test_not_enabled(self):
     self.assertTrue(is_supported_view(self.view))
     handler = CompletionHandler(self.view)
     self.assertFalse(handler.initialized)
     self.assertFalse(handler.enabled)
     result = handler.on_query_completions("", [0])
     yield 100
     self.assertTrue(handler.initialized)
     self.assertFalse(handler.enabled)
     self.assertIsNone(result)
Пример #3
0
    def test_enabled(self):
        self.view.run_command('insert', {"characters": '.'})

        self.client.send_request = MagicMock()

        handler = CompletionHandler(self.view)
        self.assertEquals(handler.state, CompletionState.IDLE)

        items, mask = handler.on_query_completions("", [1])

        self.assertEquals(len(items), 0)
        self.assertEquals(mask, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS)

        self.assertTrue(handler.initialized)
        self.assertTrue(handler.enabled)
        self.assertEquals(handler.state, CompletionState.REQUESTING)

        self.client.send_request.assert_called_once()