BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
2e53056e
Commit
2e53056e
authored
Oct 04, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds Frontend specs
parent
8d9d0f94
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
118 additions
and
11 deletions
+118
-11
clusters.js
app/assets/javascripts/clusters.js
+3
-10
show.html.haml
app/views/projects/clusters/show.html.haml
+1
-1
clusters_spec.js
spec/javascripts/clusters_spec.js
+79
-0
clusters.rb
spec/javascripts/fixtures/clusters.rb
+35
-0
No files found.
app/assets/javascripts/clusters.js
View file @
2e53056e
...
...
@@ -11,7 +11,6 @@ import './flash';
*
* - Polling status while creating or scheduled
* -- Update status area with the response result
*
*/
class
ClusterService
{
...
...
@@ -23,7 +22,7 @@ class ClusterService {
}
}
export
default
class
Cluster
Edit
{
export
default
class
Cluster
s
{
constructor
()
{
const
dataset
=
document
.
querySelector
(
'.js-edit-cluster-form'
).
dataset
;
...
...
@@ -54,12 +53,7 @@ export default class ClusterEdit {
toggle
()
{
this
.
toggleButton
.
classList
.
toggle
(
'checked'
);
this
.
state
.
toggleStatus
=
this
.
toggleButton
.
classList
.
contains
(
'checked'
).
toString
();
this
.
toggleInput
.
setAttribute
(
'value'
,
this
.
state
.
toggleStatus
);
}
updateData
()
{
this
.
service
.
updateData
(
this
.
state
.
toggleStatus
);
this
.
toggleInput
.
setAttribute
(
'value'
,
this
.
toggleButton
.
classList
.
contains
(
'checked'
).
toString
());
}
initPoling
()
{
...
...
@@ -104,7 +98,7 @@ export default class ClusterEdit {
break
;
case
'errored'
:
this
.
errorContainer
.
classList
.
remove
(
'hidden'
);
this
.
errorContainer
.
querySelector
(
'.js-error-reason'
).
textContent
=
error
.
status_reason
;
this
.
errorContainer
.
querySelector
(
'.js-error-reason'
).
textContent
=
error
;
break
;
case
'scheduled'
:
case
'creating'
:
...
...
@@ -114,5 +108,4 @@ export default class ClusterEdit {
this
.
hideAll
();
}
}
}
app/views/projects/clusters/show.html.haml
View file @
2e53056e
...
...
@@ -41,7 +41,7 @@
.hidden.js-cluster-error.alert.alert-danger
{
role:
'alert'
}
=
s_
(
'ClusterIntegration|Something went wrong while creating your cluster on Google Container Engine.'
)
%
code
.js-error-reason
%
p
.js-error-reason
.hidden.js-cluster-creating.alert.alert-info
{
role:
'alert'
}
=
s_
(
'ClusterIntegration|Cluster is being created on Google Container Engine...'
)
...
...
spec/javascripts/clusters_spec.js
0 → 100644
View file @
2e53056e
import
Clusters
from
'~/clusters'
;
describe
(
'Clusters'
,
()
=>
{
let
cluster
;
preloadFixtures
(
'clusters/show_cluster.html.raw'
);
beforeEach
(()
=>
{
loadFixtures
(
'clusters/show_cluster.html.raw'
);
cluster
=
new
Clusters
();
});
describe
(
'toggle'
,
()
=>
{
it
(
'should update the button and the input field on click'
,
()
=>
{
cluster
.
toggleButton
.
click
();
expect
(
cluster
.
toggleButton
.
classList
,
).
not
.
toContain
(
'checked'
);
expect
(
cluster
.
toggleInput
.
getAttribute
(
'value'
),
).
toEqual
(
'false'
);
});
});
describe
(
'updateContainer'
,
()
=>
{
describe
(
'when creating cluster'
,
()
=>
{
it
(
'should show the creating container'
,
()
=>
{
cluster
.
updateContainer
(
'creating'
);
expect
(
cluster
.
creatingContainer
.
classList
,
).
not
.
toContain
(
'hidden'
);
expect
(
cluster
.
successContainer
.
classList
,
).
toContain
(
'hidden'
);
expect
(
cluster
.
errorContainer
.
classList
,
).
toContain
(
'hidden'
);
});
});
describe
(
'when cluster is created'
,
()
=>
{
it
(
'should show the success container'
,
()
=>
{
cluster
.
updateContainer
(
'created'
);
expect
(
cluster
.
creatingContainer
.
classList
,
).
toContain
(
'hidden'
);
expect
(
cluster
.
successContainer
.
classList
,
).
not
.
toContain
(
'hidden'
);
expect
(
cluster
.
errorContainer
.
classList
,
).
toContain
(
'hidden'
);
});
});
describe
(
'when cluster has error'
,
()
=>
{
it
(
'should show the error container'
,
()
=>
{
cluster
.
updateContainer
(
'errored'
,
'this is an error'
);
expect
(
cluster
.
creatingContainer
.
classList
,
).
toContain
(
'hidden'
);
expect
(
cluster
.
successContainer
.
classList
,
).
toContain
(
'hidden'
);
expect
(
cluster
.
errorContainer
.
classList
,
).
not
.
toContain
(
'hidden'
);
expect
(
cluster
.
errorContainer
.
querySelector
(
'.js-error-reason'
).
textContent
,
).
toContain
(
'this is an error'
);
});
});
});
});
spec/javascripts/fixtures/clusters.rb
0 → 100644
View file @
2e53056e
require
'spec_helper'
describe
Projects
::
ClustersController
,
'(JavaScript fixtures)'
,
type: :controller
do
include
JavaScriptFixturesHelpers
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:namespace
)
{
create
(
:namespace
,
name:
'frontend-fixtures'
)}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
)
}
let
(
:cluster
)
{
project
.
create_cluster!
(
gcp_cluster_name:
"gke-test-creation-1"
,
gcp_project_id:
'gitlab-internal-153318'
,
gcp_cluster_zone:
'us-central1-a'
,
gcp_cluster_size:
'1'
,
project_namespace:
'aaa'
,
gcp_machine_type:
'n1-standard-1'
)}
render_views
before
(
:all
)
do
clean_frontend_fixtures
(
'branches/'
)
end
before
do
sign_in
(
admin
)
end
after
do
remove_repository
(
project
)
end
it
'clusters/show_cluster.html.raw'
do
|
example
|
get
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
cluster
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment