mirror of
https://github.com/portainer/portainer.git
synced 2025-07-28 01:39:39 +02:00
chore(project): add prettier for code format (#3645)
* chore(project): install prettier and lint-staged * chore(project): apply prettier to html too * chore(project): git ignore eslintcache * chore(project): add a comment about format script * chore(prettier): update printWidth * chore(prettier): remove useTabs option * chore(prettier): add HTML validation * refactor(prettier): fix closing tags * feat(prettier): define angular parser for html templates * style(prettier): run prettier on codebase Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
parent
6663073be1
commit
cf5056d9c0
714 changed files with 31228 additions and 28305 deletions
|
@ -1,57 +1,53 @@
|
|||
describe('ContainerController', function () {
|
||||
var $scope, $httpBackend, mockContainer, $routeParams;
|
||||
var $scope, $httpBackend, mockContainer, $routeParams;
|
||||
|
||||
beforeEach(module('portainer'));
|
||||
beforeEach(module('portainer'));
|
||||
|
||||
|
||||
beforeEach(inject(function ($rootScope, $controller, _$routeParams_) {
|
||||
|
||||
$scope = $rootScope.$new();
|
||||
$routeParams = _$routeParams_;
|
||||
$controller('ContainerController', {
|
||||
$scope: $scope
|
||||
});
|
||||
|
||||
angular.mock.inject(function (_$httpBackend_, _Container_) {
|
||||
mockContainer = _Container_;
|
||||
$httpBackend = _$httpBackend_;
|
||||
});
|
||||
}));
|
||||
|
||||
function expectGetContainer() {
|
||||
$httpBackend.expectGET('dockerapi/containers/json').respond({
|
||||
'Created': 1421817232,
|
||||
'id': 'b17882378cee8ec0136f482681b764cca430befd52a9bfd1bde031f49b8bba9f',
|
||||
'Image': 'portainer:latest',
|
||||
'Name': '/portainer'
|
||||
});
|
||||
}
|
||||
|
||||
it("a correct rename request to the Docker remote API", function () {
|
||||
|
||||
$routeParams.id = 'b17882378cee8ec0136f482681b764cca430befd52a9bfd1bde031f49b8bba9f';
|
||||
$scope.container = {
|
||||
'Created': 1421817232,
|
||||
'id': 'b17882378cee8ec0136f482681b764cca430befd52a9bfd1bde031f49b8bba9f',
|
||||
'Image': 'portainer:latest',
|
||||
'Name': '/portainer'
|
||||
};
|
||||
$scope.container.newContainerName = "newName";
|
||||
|
||||
var newContainerName = "newName";
|
||||
expectGetContainer();
|
||||
|
||||
$httpBackend.expectGET('dockerapi/containers/changes').respond([{"Kind": 1, "Path": "/docker.sock"}]);
|
||||
|
||||
$httpBackend.expectPOST('dockerapi/containers/' + $routeParams.id + '/rename?name=newName').
|
||||
respond({
|
||||
'name': newContainerName
|
||||
});
|
||||
|
||||
$scope.renameContainer();
|
||||
|
||||
$httpBackend.flush();
|
||||
expect($scope.container.Name).toBe(newContainerName);
|
||||
expect($scope.container.edit).toBeFalsy();
|
||||
beforeEach(inject(function ($rootScope, $controller, _$routeParams_) {
|
||||
$scope = $rootScope.$new();
|
||||
$routeParams = _$routeParams_;
|
||||
$controller('ContainerController', {
|
||||
$scope: $scope,
|
||||
});
|
||||
});
|
||||
|
||||
angular.mock.inject(function (_$httpBackend_, _Container_) {
|
||||
mockContainer = _Container_;
|
||||
$httpBackend = _$httpBackend_;
|
||||
});
|
||||
}));
|
||||
|
||||
function expectGetContainer() {
|
||||
$httpBackend.expectGET('dockerapi/containers/json').respond({
|
||||
Created: 1421817232,
|
||||
id: 'b17882378cee8ec0136f482681b764cca430befd52a9bfd1bde031f49b8bba9f',
|
||||
Image: 'portainer:latest',
|
||||
Name: '/portainer',
|
||||
});
|
||||
}
|
||||
|
||||
it('a correct rename request to the Docker remote API', function () {
|
||||
$routeParams.id = 'b17882378cee8ec0136f482681b764cca430befd52a9bfd1bde031f49b8bba9f';
|
||||
$scope.container = {
|
||||
Created: 1421817232,
|
||||
id: 'b17882378cee8ec0136f482681b764cca430befd52a9bfd1bde031f49b8bba9f',
|
||||
Image: 'portainer:latest',
|
||||
Name: '/portainer',
|
||||
};
|
||||
$scope.container.newContainerName = 'newName';
|
||||
|
||||
var newContainerName = 'newName';
|
||||
expectGetContainer();
|
||||
|
||||
$httpBackend.expectGET('dockerapi/containers/changes').respond([{ Kind: 1, Path: '/docker.sock' }]);
|
||||
|
||||
$httpBackend.expectPOST('dockerapi/containers/' + $routeParams.id + '/rename?name=newName').respond({
|
||||
name: newContainerName,
|
||||
});
|
||||
|
||||
$scope.renameContainer();
|
||||
|
||||
$httpBackend.flush();
|
||||
expect($scope.container.Name).toBe(newContainerName);
|
||||
expect($scope.container.edit).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue