1
0
mirror of https://github.com/typemill/typemill.git synced 2025-04-21 04:21:56 +02:00

Hotfix 1.3.6.3: Language Settings

This commit is contained in:
trendschau 2020-05-17 10:23:36 +02:00
parent 14c36c0d88
commit 8d409f5b88
4 changed files with 233 additions and 14 deletions

View File

@ -4,6 +4,7 @@ describe('Typemill Setup', function()
{
// visit setup form
cy.visit('/setup')
// cy.visit('/setup',{ onBeforeLoad: (_contentWindow) => { Object.defineProperty(navigator, 'language', { value: 'fr-FR' }) } })
cy.url().should('include','/setup')
// add data and check attributes
@ -63,7 +64,7 @@ describe('Typemill Setup', function()
Cypress.Cookies.preserveOnce('typemill-session')
// clicks link on welcome page to settings page
cy.get('.button').should('contain', 'Configure your website')
// cy.get('.button').should('contain', 'Configure your website')
cy.get('.button').click()
cy.url().should('include', '/tm/settings')
})
@ -74,16 +75,30 @@ describe('Typemill Setup', function()
.should('have.value', 'TYPEMILL')
.and('have.attr','required')
cy.get('input[name="settings[author]"]')
.should('have.value', 'Unknown')
cy.get('select[name="settings[copyright]"]')
cy.get('input[name="settings[year]"]')
.should('have.attr', 'required')
cy.get('select[name="settings[language]"]')
// cy.get('select[name="settings[langattr]"]')
cy.get('input[name="settings[sitemap]"]')
.should('have.value', 'http://localhost/typemillTest/cache/sitemap.xml')
.and('have.attr','readonly')
Cypress.Cookies.preserveOnce('typemill-session')
})
cy.get('input[name="settings[logo]"]')
cy.get('input[name="settings[deletelogo]"]')
cy.get('input[name="settings[favicon]"]')
cy.get('input[name="settings[deletefav]"]')
cy.get('input[name="settings[headlineanchors]"]')
cy.get('input[name="settings[editor]"]')
cy.get('select[name="settings[language]"]')
.select('en')
.should('have.value', 'en')
cy.get('form').submit()
cy.get('#flash-message').should('contain', 'Settings are stored')
Cypress.Cookies.preserveOnce('typemill-session')
})
it('creates default user data', function()
{
@ -95,6 +110,14 @@ describe('Typemill Setup', function()
.and('have.attr','disabled')
cy.get('input[name="username"]')
.should('have.value', 'trendschau')
cy.get('input[name="firstname"]')
.clear()
.type('Sebastian')
.should('have.value', 'Sebastian')
cy.get('input[name="lastname"]')
.clear()
.type('Schürmanns')
.should('have.value', 'Schürmanns')
cy.get('input[name="email"]')
.should('have.value', 'trendschau@gmail.com')
.and('have.attr','required')
@ -104,6 +127,10 @@ describe('Typemill Setup', function()
.should('have.value', '')
cy.get('input[name="newpassword"]')
.should('have.value', '')
cy.get('#userform').submit()
cy.get('#flash-message').should('contain', 'Saved all changes')
})
it('logouts out', function()

View File

@ -105,14 +105,19 @@ describe('Typemill Initial Frontend', function()
/* images */
cy.get('img').eq(0).should('have.attr', 'alt', 'alt-text')
cy.get('img').eq(0).should('have.attr', 'src', 'media/markdown.png')
cy.get('img').eq(2).should('have.id', 'myid')
cy.get('figure').eq(2).should('have.id', 'myid')
.and('have.class', 'otherclass')
.and('have.attr', 'alt', 'alt-text')
cy.get('img').eq(2).should('have.attr', 'alt', 'alt-text')
.and('have.attr', 'title', 'my title')
.and('have.attr', 'width', '150px')
/* blockquote */
cy.get('blockquote').should('exist')
/* has navigation element */
cy.get('.notice1').should('exist')
cy.get('.notice2').should('exist')
cy.get('.notice3').should('exist')
/* footnote */
cy.get('sup').eq(0).should('have.id', 'fnref1:1')

View File

@ -0,0 +1,183 @@
describe('Blox Editor', function()
{
before(function ()
{
cy.visit('/tm/login')
cy.url().should('include','/tm/login')
cy.get('input[name="username"]').type('trendschau')
cy.get('input[name="password"]').type('password')
cy.get('form').submit()
cy.url().should('include','/tm/content')
cy.getCookie('typemill-session').should('exist')
cy.visit('/tm/content/visual')
cy.url().should('include','/tm\/content\/visual')
})
beforeEach(function ()
{
Cypress.Cookies.preserveOnce('typemill-session')
})
it('creates new page', function()
{
// click on add element
cy.get('.addNaviItem > a').eq(0).click()
/* Check dublicates cannot be made */
/* Check new page can be created */
cy.get('.addNaviForm').within(($naviform) =>{
/* add Testpage into input */
cy.get('input')
.clear()
.type('Testpage')
.should('have.value', 'Testpage')
cy.get('.b-left').click()
})
/* get Navilist */
cy.get('.navi-list')
.should('contain', 'Testpage')
.eq(2).find('a').should(($a) => {
expect($a).to.have.length(5)
expect($a[4].href).to.include('/welcome\/testpage')
})
})
it('edits default content', function()
{
cy.visit('/tm/content/visual/welcome/testpage')
cy.url().should('include','/tm\/content\/visual\/welcome\/testpage')
cy.get('#blox').within(($blox) => {
/* Change Title */
cy.get('#blox-0').click()
cy.get("input")
.clear()
.type("This is my Testpage")
cy.get(".edit").click()
cy.get('#blox-0').should("contain", "This is my Testpage")
/* Change Text */
cy.get('#blox-1').click()
cy.get("textarea")
.clear()
.type("This is the new paragraph for the first line with some text.")
cy.get(".edit").click()
cy.get('#blox-1').should("contain", "new paragraph")
})
})
it('edits table', function()
{
cy.get('#blox').within(($blox) => {
/* Get Format Bar */
cy.get('.format-bar').within(($formats) => {
/* Edit Table */
cy.get("button").eq(4).click()
cy.get("table").within(($table) => {
/* edit table head */
cy.get("tr").eq(1).within(($row) => {
cy.get("th").eq(1).click()
.clear()
.type("first Headline")
cy.get("th").eq(2).click()
.clear()
.type("Second Headline")
})
/* edit first content row */
cy.get("tr").eq(2).within(($row) => {
cy.get("td").eq(1).click()
.clear()
.type("Some")
cy.get("td").eq(2).click()
.clear()
.type("More")
})
/* edit second content row */
cy.get("tr").eq(3).within(($row) => {
cy.get("td").eq(1).click()
.clear()
.type("Beautiful")
cy.get("td").eq(2).click()
.clear()
.type("Content")
})
/* add new column on the right */
cy.get("tr").eq(0).within(($row) => {
cy.get("td").eq(2).click()
cy.get(".actionline").eq(0).click()
})
})
cy.get("table").within(($table) => {
/* edit second new column head */
cy.get("tr").eq(1).within(($row) => {
cy.get("th").eq(3).click()
.clear()
.type("New Head")
})
/* edit second new column head */
cy.get("tr").eq(2).within(($row) => {
cy.get("td").eq(3).click()
.clear()
.type("With")
})
/* edit second new column head */
cy.get("tr").eq(3).within(($row) => {
cy.get("td").eq(3).click()
.clear()
.type("new Content")
})
})
/* save table */
cy.get(".edit").click()
})
cy.get('#blox-2').should("contain", "Beautiful").click()
cy.get('.editactive').within(($activeblock) => {
cy.get('.component').should("contain", "Beautiful")
})
})
})
it('Deletes new page', function()
{
cy.visit('/tm/content/visual/welcome/testpage')
cy.url().should('include','/tm\/content\/visual\/welcome\/testpage')
cy.get('.danger').click()
cy.get('#modalWindow').within(($modal) => {
cy.get('button').click()
})
cy.visit('/tm/content/visual/welcome')
cy.get('.navi-list')
.not('contain', 'Testpage')
.eq(2).find('a').should(($a) => {
expect($a).to.have.length(4)
})
})
})

View File

@ -128,7 +128,11 @@ class Settings
$theme_language_file = $language . '.yaml';
if (file_exists($theme_language_folder . $theme_language_file))
{
$theme_labels = $yaml->getYaml($theme_language_folder, $theme_language_file);
$this_theme_labels = $yaml->getYaml($theme_language_folder, $theme_language_file);
if(is_array($this_theme_labels))
{
$theme_labels = $this_theme_labels;
}
}
# loads the plugins strings of the set language
@ -143,20 +147,20 @@ class Settings
if (file_exists($plugin_language_folder . $plugin_language_file))
{
$plugin_labels[$name] = $yaml->getYaml($plugin_language_folder, $plugin_language_file);
$this_plugin_labels = $yaml->getYaml($plugin_language_folder, $plugin_language_file);
if(is_array($this_plugin_labels))
{
$plugin_labels[$name] = $this_plugin_labels;
}
}
}
foreach($plugin_labels as $key => $value)
{
$plugins_labels = array_merge($plugins_labels, $value);
}
}
# Combines arrays of system languages, themes and plugins
$labels = array_merge($system_labels, $theme_labels, $plugins_labels);
return $labels;
}
}
public function whichLanguage()
{