Skip to content

Commit a088954

Browse files
committed
remove jQuery from tests
1 parent 68c402c commit a088954

File tree

3 files changed

+0
-210
lines changed

3 files changed

+0
-210
lines changed

test/jasmine/assets/jquery-1.8.3.min.js

-2
This file was deleted.

test/jasmine/karma.conf.js

-5
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ if(isFullSuite) {
117117
testFileGlob = path.join(__dirname, 'tests', glob(merge(argv._).map(basename)));
118118
}
119119

120-
var pathToJQuery = path.join(__dirname, 'assets', 'jquery-1.8.3.min.js');
121120
var pathToCustomMatchers = path.join(__dirname, 'assets', 'custom_matchers.js');
122121
var pathToUnpolyfill = path.join(__dirname, 'assets', 'unpolyfill.js');
123122
var pathToSaneTopojsonDist = path.join(__dirname, '..', '..', 'node_modules', 'sane-topojson', 'dist');
@@ -318,10 +317,6 @@ func.defaultConfig = {
318317
func.defaultConfig.preprocessors[pathToCustomMatchers] = ['esbuild'];
319318
func.defaultConfig.preprocessors[testFileGlob] = ['esbuild'];
320319

321-
if(!isBundleTest) {
322-
func.defaultConfig.files.push(pathToJQuery);
323-
}
324-
325320
if(argv.virtualWebgl) {
326321
// add virtual-webgl to the top
327322
func.defaultConfig.files = [

test/jasmine/tests/events_test.js

-203
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
/* global $:false, jQuery:false */
2-
3-
/*
4-
* Note this test requires JQuery in the global scope.
5-
* we should keep it that way to keep testing our backward
6-
* compatibility with JQuery events.
7-
*/
8-
91
var Events = require('../../../src/lib/events');
102

113
describe('Events', function() {
@@ -57,19 +49,6 @@ describe('Events', function() {
5749
});
5850
});
5951

60-
it('triggers jquery events', function(done) {
61-
Events.init(plotDiv);
62-
63-
$(plotDiv).bind('ping', function(event, data) {
64-
expect(data).toBe('pong');
65-
done();
66-
});
67-
68-
setTimeout(function() {
69-
$(plotDiv).trigger('ping', 'pong');
70-
});
71-
});
72-
7352
it('mirrors events on an internal handler', function(done) {
7453
Events.init(plotDiv);
7554

@@ -139,86 +118,6 @@ describe('Events', function() {
139118
expect(result).toBe('pong');
140119
});
141120

142-
it('triggers jQuery handlers when no matching node events bound', function() {
143-
var eventBaton = 0;
144-
145-
Events.init(plotDiv);
146-
147-
$(plotDiv).bind('ping', function() {
148-
eventBaton++;
149-
return 'ping';
150-
});
151-
152-
/*
153-
* This will not be called
154-
*/
155-
plotDiv.on('pong', function() {
156-
eventBaton++;
157-
return 'ping';
158-
});
159-
160-
$(plotDiv).bind('ping', function() {
161-
eventBaton++;
162-
return 'pong';
163-
});
164-
165-
var result = Events.triggerHandler(plotDiv, 'ping');
166-
167-
expect(eventBaton).toBe(2);
168-
expect(result).toBe('pong');
169-
});
170-
171-
it('triggers jQuery handlers when no node events initialized', function() {
172-
var eventBaton = 0;
173-
174-
$(plotDiv).bind('ping', function() {
175-
eventBaton++;
176-
return 'ping';
177-
});
178-
179-
$(plotDiv).bind('ping', function() {
180-
eventBaton++;
181-
return 'ping';
182-
});
183-
184-
$(plotDiv).bind('ping', function() {
185-
eventBaton++;
186-
return 'pong';
187-
});
188-
189-
var result = Events.triggerHandler(plotDiv, 'ping');
190-
191-
expect(eventBaton).toBe(3);
192-
expect(result).toBe('pong');
193-
});
194-
195-
196-
it('triggers jQuery + nodejs handlers and returns last jQuery value', function() {
197-
var eventBaton = 0;
198-
199-
Events.init(plotDiv);
200-
201-
$(plotDiv).bind('ping', function() {
202-
eventBaton++;
203-
return 'ping';
204-
});
205-
206-
plotDiv.on('ping', function() {
207-
eventBaton++;
208-
return 'ping';
209-
});
210-
211-
$(plotDiv).bind('ping', function() {
212-
eventBaton++;
213-
return 'pong';
214-
});
215-
216-
var result = Events.triggerHandler(plotDiv, 'ping');
217-
218-
expect(eventBaton).toBe(3);
219-
expect(result).toBe('pong');
220-
});
221-
222121
it('works with *once* event handlers', function() {
223122
var eventBaton = 0;
224123

@@ -247,106 +146,4 @@ describe('Events', function() {
247146
expect(plotObj).toEqual({});
248147
});
249148
});
250-
251-
describe('when jQuery.noConflict is set, ', function() {
252-
beforeEach(function() {
253-
$.noConflict();
254-
});
255-
256-
afterEach(function() {
257-
window.$ = jQuery;
258-
});
259-
260-
it('triggers jquery events', function(done) {
261-
Events.init(plotDiv);
262-
263-
jQuery(plotDiv).bind('ping', function(event, data) {
264-
expect(data).toBe('pong');
265-
done();
266-
});
267-
268-
setTimeout(function() {
269-
jQuery(plotDiv).trigger('ping', 'pong');
270-
});
271-
});
272-
273-
it('triggers jQuery handlers when no matching node events bound', function() {
274-
var eventBaton = 0;
275-
276-
Events.init(plotDiv);
277-
278-
jQuery(plotDiv).bind('ping', function() {
279-
eventBaton++;
280-
return 'ping';
281-
});
282-
283-
/*
284-
* This will not be called
285-
*/
286-
plotDiv.on('pong', function() {
287-
eventBaton++;
288-
return 'ping';
289-
});
290-
291-
jQuery(plotDiv).bind('ping', function() {
292-
eventBaton++;
293-
return 'pong';
294-
});
295-
296-
var result = Events.triggerHandler(plotDiv, 'ping');
297-
298-
expect(eventBaton).toBe(2);
299-
expect(result).toBe('pong');
300-
});
301-
302-
it('triggers jQuery handlers when no node events initialized', function() {
303-
var eventBaton = 0;
304-
305-
jQuery(plotDiv).bind('ping', function() {
306-
eventBaton++;
307-
return 'ping';
308-
});
309-
310-
jQuery(plotDiv).bind('ping', function() {
311-
eventBaton++;
312-
return 'ping';
313-
});
314-
315-
jQuery(plotDiv).bind('ping', function() {
316-
eventBaton++;
317-
return 'pong';
318-
});
319-
320-
var result = Events.triggerHandler(plotDiv, 'ping');
321-
322-
expect(eventBaton).toBe(3);
323-
expect(result).toBe('pong');
324-
});
325-
326-
it('triggers jQuery + nodejs handlers and returns last jQuery value', function() {
327-
var eventBaton = 0;
328-
329-
Events.init(plotDiv);
330-
331-
jQuery(plotDiv).bind('ping', function() {
332-
eventBaton++;
333-
return 'ping';
334-
});
335-
336-
plotDiv.on('ping', function() {
337-
eventBaton++;
338-
return 'ping';
339-
});
340-
341-
jQuery(plotDiv).bind('ping', function() {
342-
eventBaton++;
343-
return 'pong';
344-
});
345-
346-
var result = Events.triggerHandler(plotDiv, 'ping');
347-
348-
expect(eventBaton).toBe(3);
349-
expect(result).toBe('pong');
350-
});
351-
});
352149
});

0 commit comments

Comments
 (0)