Skip to content
Snippets Groups Projects
Commit 7a2a9bb4 authored by Mike Greiling's avatar Mike Greiling
Browse files

replace Teaspoon fixture methods with jasmine-jquery methods to reduce dependency on Teaspoon

parent 10d483ea
No related branches found
No related tags found
No related merge requests found
Showing
with 56 additions and 44 deletions
{
"plugins": ["jasmine"],
"env": {
"jasmine": true
},
"extends": "plugin:jasmine/recommended",
"globals": {
"appendLoadFixtures": false,
"appendLoadStyleFixtures": false,
"appendSetFixtures": false,
"appendSetStyleFixtures": false,
"getJSONFixture": false,
"loadFixtures": false,
"loadJSONFixtures": false,
"loadStyleFixtures": false,
"preloadFixtures": false,
"preloadStyleFixtures": false,
"readFixtures": false,
"sandbox": false,
"setFixtures": false,
"setStyleFixtures": false,
"spyOnEvent": false
},
"plugins": ["jasmine"],
"rules": {
"prefer-arrow-callback": 0,
"func-names": 0
},
"globals": {
"fixture": false,
"spyOnEvent": false
}
}
Loading
Loading
@@ -13,10 +13,10 @@
(index, element) => element.innerText.indexOf(searchText) > -1,
).first();
 
fixture.preload(FIXTURE);
preloadFixtures(FIXTURE);
 
beforeEach(function () {
fixture.load(FIXTURE);
loadFixtures(FIXTURE);
this.abuseReports = new global.AbuseReports();
messages = $('.abuse-reports .message');
});
Loading
Loading
Loading
Loading
@@ -35,7 +35,7 @@
 
describe('Activities', () => {
beforeEach(() => {
fixture.load(fixtureTemplate);
loadFixtures(fixtureTemplate);
new gl.Activities();
});
 
Loading
Loading
Loading
Loading
@@ -34,9 +34,9 @@
};
 
describe('AwardsHandler', function() {
fixture.preload('issues/open-issue.html.raw');
preloadFixtures('issues/open-issue.html.raw');
beforeEach(function() {
fixture.load('issues/open-issue.html.raw');
loadFixtures('issues/open-issue.html.raw');
awardsHandler = new AwardsHandler;
spyOn(awardsHandler, 'postEmoji').and.callFake((function(_this) {
return function(url, emoji, cb) {
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@
describe('Autosize behavior', function() {
var load;
beforeEach(function() {
return fixture.set('<textarea class="js-autosize" style="resize: vertical"></textarea>');
return setFixtures('<textarea class="js-autosize" style="resize: vertical"></textarea>');
});
it('does not overwrite the resize property', function() {
load();
Loading
Loading
Loading
Loading
@@ -5,9 +5,9 @@
(function() {
describe('Quick Submit behavior', function() {
var keydownEvent;
fixture.preload('static/behaviors/quick_submit.html.raw');
preloadFixtures('static/behaviors/quick_submit.html.raw');
beforeEach(function() {
fixture.load('static/behaviors/quick_submit.html.raw');
loadFixtures('static/behaviors/quick_submit.html.raw');
$('form').submit(function(e) {
// Prevent a form submit from moving us off the testing page
return e.preventDefault();
Loading
Loading
Loading
Loading
@@ -4,9 +4,9 @@
 
(function() {
describe('requiresInput', function() {
fixture.preload('static/behaviors/requires_input.html.raw');
preloadFixtures('static/behaviors/requires_input.html.raw');
beforeEach(function() {
return fixture.load('static/behaviors/requires_input.html.raw');
return loadFixtures('static/behaviors/requires_input.html.raw');
});
it('disables submit when any field is required', function() {
$('.js-requires-input').requiresInput();
Loading
Loading
Loading
Loading
@@ -2,10 +2,10 @@
 
(() => {
describe('Linked Tabs', () => {
fixture.preload('static/linked_tabs.html.raw');
preloadFixtures('static/linked_tabs.html.raw');
 
beforeEach(() => {
fixture.load('static/linked_tabs.html.raw');
loadFixtures('static/linked_tabs.html.raw');
});
 
describe('when is initialized', () => {
Loading
Loading
Loading
Loading
@@ -17,10 +17,10 @@ describe('Build', () => {
offset: BUILD_TRACE.length, n_open_tags: 0, fg_color: null, bg_color: null, style_mask: 0,
}));
 
fixture.preload('builds/build-with-artifacts.html.raw');
preloadFixtures('builds/build-with-artifacts.html.raw');
 
beforeEach(() => {
fixture.load('builds/build-with-artifacts.html.raw');
loadFixtures('builds/build-with-artifacts.html.raw');
spyOn($, 'ajax');
});
 
Loading
Loading
Loading
Loading
@@ -17,9 +17,9 @@
$(document).trigger('todo:toggle', newCount);
}
 
fixture.preload(fixtureTemplate);
preloadFixtures(fixtureTemplate);
beforeEach(() => {
fixture.load(fixtureTemplate);
loadFixtures(fixtureTemplate);
new global.Sidebar();
});
 
Loading
Loading
Loading
Loading
@@ -2,10 +2,10 @@
//= require environments/components/environment_actions
 
describe('Actions Component', () => {
fixture.preload('static/environments/element.html.raw');
preloadFixtures('static/environments/element.html.raw');
 
beforeEach(() => {
fixture.load('static/environments/element.html.raw');
loadFixtures('static/environments/element.html.raw');
});
 
it('should render a dropdown with the provided actions', () => {
Loading
Loading
Loading
Loading
@@ -2,9 +2,9 @@
//= require environments/components/environment_external_url
 
describe('External URL Component', () => {
fixture.preload('static/environments/element.html.raw');
preloadFixtures('static/environments/element.html.raw');
beforeEach(() => {
fixture.load('static/environments/element.html.raw');
loadFixtures('static/environments/element.html.raw');
});
 
it('should link to the provided externalUrl prop', () => {
Loading
Loading
Loading
Loading
@@ -3,9 +3,9 @@
//= require environments/components/environment_item
 
describe('Environment item', () => {
fixture.preload('static/environments/table.html.raw');
preloadFixtures('static/environments/table.html.raw');
beforeEach(() => {
fixture.load('static/environments/table.html.raw');
loadFixtures('static/environments/table.html.raw');
});
 
describe('When item is folder', () => {
Loading
Loading
//= require vue
//= require environments/components/environment_rollback
describe('Rollback Component', () => {
fixture.preload('static/environments/element.html.raw');
preloadFixtures('static/environments/element.html.raw');
 
const retryURL = 'https://gitlab.com/retry';
 
beforeEach(() => {
fixture.load('static/environments/element.html.raw');
loadFixtures('static/environments/element.html.raw');
});
 
it('Should link to the provided retryUrl', () => {
Loading
Loading
//= require vue
//= require environments/components/environment_stop
describe('Stop Component', () => {
fixture.preload('static/environments/element.html.raw');
preloadFixtures('static/environments/element.html.raw');
 
let stopURL;
let component;
 
beforeEach(() => {
fixture.load('static/environments/element.html.raw');
loadFixtures('static/environments/element.html.raw');
 
stopURL = '/stop';
component = new window.gl.environmentsList.StopComponent({
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@
describe('jQuery extensions', function() {
describe('disable', function() {
beforeEach(function() {
return fixture.set('<input type="text" />');
return setFixtures('<input type="text" />');
});
it('adds the disabled attribute', function() {
var $input;
Loading
Loading
@@ -23,7 +23,7 @@
});
return describe('enable', function() {
beforeEach(function() {
return fixture.set('<input type="text" disabled="disabled" class="disabled" />');
return setFixtures('<input type="text" disabled="disabled" class="disabled" />');
});
it('removes the disabled attribute', function() {
var $input;
Loading
Loading
Loading
Loading
@@ -43,8 +43,7 @@
}
 
describe('Dropdown', function describeDropdown() {
fixture.preload('static/gl_dropdown.html.raw');
fixture.preload('projects.json');
preloadFixtures('static/gl_dropdown.html.raw');
 
function initDropDown(hasRemote, isFilterable) {
this.dropdownButtonElement = $('#js-project-dropdown', this.dropdownContainerElement).glDropdown({
Loading
Loading
@@ -61,10 +60,10 @@
}
 
beforeEach(() => {
fixture.load('static/gl_dropdown.html.raw');
loadFixtures('static/gl_dropdown.html.raw');
this.dropdownContainerElement = $('.dropdown.inline');
this.$dropdownMenuElement = $('.dropdown-menu', this.dropdownContainerElement);
this.projectsData = fixture.load('projects.json')[0];
this.projectsData = getJSONFixture('projects.json');
});
 
afterEach(() => {
Loading
Loading
Loading
Loading
@@ -4,11 +4,11 @@
//= require gl_field_errors
 
((global) => {
fixture.preload('static/gl_field_errors.html.raw');
preloadFixtures('static/gl_field_errors.html.raw');
 
describe('GL Style Field Errors', function() {
beforeEach(function() {
fixture.load('static/gl_field_errors.html.raw');
loadFixtures('static/gl_field_errors.html.raw');
const $form = this.$form = $('form.gl-show-field-errors');
this.fieldErrors = new global.GlFieldErrors($form);
});
Loading
Loading
Loading
Loading
@@ -17,9 +17,9 @@
$(document).trigger('todo:toggle', newCount);
}
 
fixture.preload(fixtureTemplate);
preloadFixtures(fixtureTemplate);
beforeEach(function() {
fixture.load(fixtureTemplate);
loadFixtures(fixtureTemplate);
});
 
it('should update todos-pending-count after receiving the todo:toggle event', function() {
Loading
Loading
Loading
Loading
@@ -21,10 +21,10 @@
}
 
describe('Issuable', () => {
fixture.preload('static/issuable_filter.html.raw');
preloadFixtures('static/issuable_filter.html.raw');
 
beforeEach(() => {
fixture.load('static/issuable_filter.html.raw');
loadFixtures('static/issuable_filter.html.raw');
Issuable.init();
});
 
Loading
Loading
@@ -37,7 +37,7 @@
 
beforeEach(() => {
$filtersForm = $('.js-filter-form');
fixture.load('static/issuable_filter.html.raw');
loadFixtures('static/issuable_filter.html.raw');
resetForm($filtersForm);
});
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment