Commit 33e9909a authored by Samantha Ming's avatar Samantha Ming

Update to display full name for namespace

Switch over to display full name of fork namespace.
And sorting it by its full name.
parent ce2b5a1f
......@@ -44,7 +44,7 @@ function sortNamespaces(namespaces) {
return namespaces;
}
return namespaces.sort((a, b) => a.name.localeCompare(b.name));
return namespaces.sort((a, b) => a.full_name.localeCompare(b.full_name));
}
export default {
......@@ -313,7 +313,7 @@ export default {
<option :value="null" disabled>{{ s__('ForkProject|Select a namespace') }}</option>
</template>
<option v-for="namespace in namespaces" :key="namespace.id" :value="namespace">
{{ namespace.name }}
{{ namespace.full_name }}
</option>
</gl-form-select>
</gl-form-input-group>
......
......@@ -29,10 +29,12 @@ describe('ForkForm component', () => {
const MOCK_NAMESPACES_RESPONSE = [
{
name: 'one',
full_name: 'one-group/one',
id: 1,
},
{
name: 'two',
full_name: 'two-group/two',
id: 2,
},
];
......@@ -178,13 +180,14 @@ describe('ForkForm component', () => {
const optionsArray = findForkUrlInput().findAll('option');
expect(optionsArray).toHaveLength(MOCK_NAMESPACES_RESPONSE.length + 1);
expect(optionsArray.at(1).text()).toBe(MOCK_NAMESPACES_RESPONSE[0].name);
expect(optionsArray.at(2).text()).toBe(MOCK_NAMESPACES_RESPONSE[1].name);
expect(optionsArray.at(1).text()).toBe(MOCK_NAMESPACES_RESPONSE[0].full_name);
expect(optionsArray.at(2).text()).toBe(MOCK_NAMESPACES_RESPONSE[1].full_name);
});
it('set namespaces in alphabetical order', async () => {
const namespace = {
name: 'aaa',
name: 'three',
full_name: 'aaa/three',
id: 3,
};
mockGetRequest({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment