display & update the number of unread items on every page with an "unread items" menu
This commit is contained in:
parent
3b33544cae
commit
71275eac2c
34
assets/js/all.min.js
vendored
34
assets/js/all.min.js
vendored
@ -1,20 +1,20 @@
|
||||
var Miniflux={};Miniflux.App=function(){return{Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents()}}}();
|
||||
Miniflux.Feed=function(){var d=[];return{Update:function(c,a){var b=c.querySelector("span.items-count");if(b){var d=c.getAttribute("data-feed-id"),e=c.querySelector("h2:first-of-type");e.className="loading-icon";var f=new XMLHttpRequest;f.onload=function(){e.className="";var f=c.querySelector(".feed-last-checked");f&&(f.innerHTML=f.getAttribute("data-after-update"));if(f=c.querySelector(".feed-parsing-error"))f.innerHTML="";var d=JSON.parse(this.responseText);d.result?b.innerHTML=d.items_count.items_unread+
|
||||
"/"+d.items_count.items_total:f&&(f.innerHTML=f.getAttribute("data-after-error"));a&&a(d)};f.open("POST","?action=refresh-feed&feed_id="+d,!0);f.send()}},UpdateAll:function(){var c=Array.prototype.slice.call(document.querySelectorAll("article:not([data-feed-disabled])")),a=setInterval(function(){for(;0<c.length&&5>d.length;){var b=c.shift();d.push(parseInt(b.getAttribute("data-feed-id")));Miniflux.Feed.Update(b,function(b){b=d.indexOf(b.feed_id);0<=b&&d.splice(b,1);0===c.length&&0===d.length&&(clearInterval(a),
|
||||
Miniflux.Feed=function(){var b=[];return{Update:function(e,a){var d=e.querySelector("span.items-count");if(d){var b=e.getAttribute("data-feed-id"),l=e.querySelector("h2:first-of-type");l.className="loading-icon";var g=new XMLHttpRequest;g.onload=function(){l.className="";var b=e.querySelector(".feed-last-checked");b&&(b.innerHTML=b.getAttribute("data-after-update"));if(b=e.querySelector(".feed-parsing-error"))b.innerHTML="";var c=JSON.parse(this.responseText);c.result?d.innerHTML=c.items_count.items_unread+
|
||||
"/"+c.items_count.items_total:b&&(b.innerHTML=b.getAttribute("data-after-error"));a&&a(c)};g.open("POST","?action=refresh-feed&feed_id="+b,!0);g.send()}},UpdateAll:function(){var e=Array.prototype.slice.call(document.querySelectorAll("article:not([data-feed-disabled])")),a=setInterval(function(){for(;0<e.length&&5>b.length;){var d=e.shift();b.push(parseInt(d.getAttribute("data-feed-id")));Miniflux.Feed.Update(d,function(d){d=b.indexOf(d.feed_id);0<=d&&b.splice(d,1);0===e.length&&0===b.length&&(clearInterval(a),
|
||||
window.location.href="?action=unread")})}},100)}}}();
|
||||
Miniflux.Item=function(){function d(e){return item_id=e.getAttribute("data-item-id")}function c(e){if(e&&e.hasAttribute("data-reverse-label")){var a=e.innerHTML;e.innerHTML=e.getAttribute("data-reverse-label");e.setAttribute("data-reverse-label",a)}}function a(e){"mouse"!==Miniflux.Event.lastEventType&&Miniflux.Nav.SelectNextItem();e.parentNode.removeChild(e);if(e=document.getElementById("page-counter")){var a=document.querySelector("section.page"),b=parseInt(e.textContent,10)-1,c=document.getElementsByTagName("article");
|
||||
if(0===b||0===c.length)window.location=location.href;e.textContent=b;switch(a.getAttribute("data-item-page")){case "unread":document.title="Miniflux ("+b+")";document.getElementById("nav-counter").textContent=b;break;case "feed-items":document.title="("+b+") "+e.parentNode.firstChild.nodeValue;break;default:document.title=e.parentNode.firstChild.nodeValue+" ("+b+")"}}}function b(e){var b=d(e),g=new XMLHttpRequest;g.onload=function(){if(Miniflux.Nav.IsListing())if(e.getAttribute("data-hide"))a(e);
|
||||
else{e.setAttribute("data-item-status","read");var b=e.querySelector("a.mark");c(b);(b=e.querySelector("a.mark"))&&b.setAttribute("data-action","mark-unread")}};g.open("POST","?action=mark-item-read&id="+b,!0);g.send()}function h(e){var b=d(e),g=new XMLHttpRequest;g.onload=function(){if(Miniflux.Nav.IsListing())if(e.getAttribute("data-hide"))a(e);else{e.setAttribute("data-item-status","unread");var b=e.querySelector("a.mark");c(b);(b=e.querySelector("a.mark"))&&b.setAttribute("data-action","mark-read")}};
|
||||
g.open("POST","?action=mark-item-unread&id="+b,!0);g.send()}return{MarkAsRead:b,MarkAsUnread:h,MarkAsRemoved:function(b){var f=d(b),c=new XMLHttpRequest;c.onload=function(){Miniflux.Nav.IsListing()&&a(b)};c.open("POST","?action=mark-item-removed&id="+f,!0);c.send()},SwitchBookmark:function(b){var f=d(b),g="1"===b.getAttribute("data-item-bookmark")?"0":"1",k=new XMLHttpRequest;k.onload=function(){var f=document.querySelector("section.page");if(Miniflux.Nav.IsListing()&&"bookmarks"===f.getAttribute("data-item-page"))a(b);
|
||||
else if(b.setAttribute("data-item-bookmark",g),Miniflux.Nav.IsListing())f=b.querySelector("a.bookmark"),c(f);else if((f=b.querySelector("a.bookmark-icon"))&&f.hasAttribute("data-reverse-title")){var d=f.getAttribute("title");f.setAttribute("title",f.getAttribute("data-reverse-title"));f.setAttribute("data-reverse-title",d)}};k.open("POST","?action=bookmark&id="+f+"&value="+g,!0);k.send()},SwitchStatus:function(a){var f=a.getAttribute("data-item-status");"read"===f?h(a):"unread"===f&&b(a)},Show:function(b){(b=
|
||||
b.querySelector("a.show"))&&b.click()},OpenOriginal:function(a){var f=a.querySelector("a.original");f&&("unread"===a.getAttribute("data-item-status")&&b(a),f.removeAttribute("data-action"),"mouse"!==Miniflux.Event.lastEventType&&f.click())},DownloadContent:function(b){var a=document.getElementById("download-item");if(a){a.innerHTML=" "+a.getAttribute("data-before-message");a.className="loading-icon";var c=new XMLHttpRequest;c.onload=function(){var b=JSON.parse(c.responseText);a.className="";if(b.result){var e=
|
||||
document.getElementById("item-content");e&&(e.innerHTML=b.content);a.innerHTML=a.getAttribute("data-after-message")}else a.innerHTML=a.getAttribute("data-failure-message")};b=d(b);c.open("POST","?action=download-item&id="+b,!0);c.send()}},MarkListingAsRead:function(b){for(var a=document.getElementsByTagName("article"),c=[],k=0,h=a.length;k<h;k++)c.push(d(a[k]));a=new XMLHttpRequest;a.onload=function(){window.location.href=b};a.open("POST","?action=mark-items-as-read",!0);a.send(JSON.stringify(c))},
|
||||
ToggleRTLMode:function(){for(var a=["#current-item h1","#item-content","#listing #current-item h2","#listing #current-item .preview"],b=0;b<a.length;b++){var c=document.querySelector(a[b]);c&&(c.dir=""==c.dir?"rtl":"")}}}}();
|
||||
Miniflux.Event=function(){var d=[];return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(c){var a=c.target.getAttribute("data-action");a&&"original-link"!==a&&c.preventDefault()};document.onmouseup=function(c){if(2!==c.button)if("INPUT"===c.target.nodeName&&"auto-select"===c.target.className)c.target.select();else{var a=c.target.getAttribute("data-action");if(a){Miniflux.Event.lastEventType="mouse";var b;a:{for(element=c.target;element&&element.parentNode;)if(element=element.parentNode,
|
||||
element.tagName&&"article"===element.tagName.toLowerCase()){b=element;break a}b=null}switch(a){case "refresh-all":Miniflux.Feed.UpdateAll();break;case "refresh-feed":Miniflux.Feed.Update(b);break;case "mark-read":Miniflux.Item.MarkAsRead(b);break;case "mark-unread":Miniflux.Item.MarkAsUnread(b);break;case "mark-removed":Miniflux.Item.MarkAsRemoved(b);break;case "bookmark":Miniflux.Item.SwitchBookmark(b);break;case "download-item":Miniflux.Item.DownloadContent(b);break;case "original-link":Miniflux.Item.OpenOriginal(b);
|
||||
break;case "mark-all-read":Miniflux.Item.MarkListingAsRead("?action=unread");break;case "mark-feed-read":Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+c.target.getAttribute("data-feed-id"))}}}}},ListenKeyboardEvents:function(){document.onkeypress=function(c){if(63===c.keyCode||!(c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)){var a=c.target||c.srcElement;if("INPUT"!==a.tagName&&"TEXTAREA"!==a.tagName)if(Miniflux.Event.lastEventType="keyboard",d.push(c.keyCode||c.which),103===d[0])switch(d[1]){case void 0:break;
|
||||
case 117:window.location.href="?action=unread";d=[];break;case 98:window.location.href="?action=bookmarks";d=[];break;case 104:window.location.href="?action=history";d=[];break;case 115:window.location.href="?action=feeds";d=[];break;case 112:window.location.href="?action=config";d=[];break;default:d=[]}else switch(d=[],a=document.getElementById("current-item"),c.keyCode||c.which){case 100:Miniflux.Item.DownloadContent(a);break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();break;case 110:case 106:Miniflux.Nav.SelectNextItem();
|
||||
Miniflux.Item=function(){function b(c){return item_id=c.getAttribute("data-item-id")}function e(c){if(c&&c.hasAttribute("data-reverse-label")){var a=c.innerHTML;c.innerHTML=c.getAttribute("data-reverse-label");c.setAttribute("data-reverse-label",a)}}function a(c){"mouse"!==Miniflux.Event.lastEventType&&Miniflux.Nav.SelectNextItem();c.parentNode.removeChild(c);m--}function d(){0===m&&window.location.reload();var c=document.getElementById("page-counter");c.textContent=m||"";document.getElementById("nav-counter").textContent=
|
||||
g||"";switch(document.querySelector("section.page").getAttribute("data-item-page")){case "unread":document.title="Miniflux ("+g+")";break;case "feed-items":document.title="("+m+") "+c.parentNode.firstChild.nodeValue;break;default:document.title=c.parentNode.firstChild.nodeValue+" ("+m+")"}}function h(c){var k=b(c),f=new XMLHttpRequest;f.onload=function(){if(Miniflux.Nav.IsListing()){if(c.getAttribute("data-hide"))a(c);else{c.setAttribute("data-item-status","read");var b=c.querySelector("a.mark");
|
||||
e(b);(b=c.querySelector("a.mark"))&&b.setAttribute("data-action","mark-unread")}g--;d()}};f.open("POST","?action=mark-item-read&id="+k,!0);f.send()}function l(c){var k=b(c),f=new XMLHttpRequest;f.onload=function(){if(Miniflux.Nav.IsListing()){if(c.getAttribute("data-hide"))a(c);else{c.setAttribute("data-item-status","unread");var b=c.querySelector("a.mark");e(b);(b=c.querySelector("a.mark"))&&b.setAttribute("data-action","mark-read")}g++;d()}};f.open("POST","?action=mark-item-unread&id="+k,!0);f.send()}
|
||||
var g=function(){var c=document.getElementById("nav-counter");if(c)return counter=parseInt(c.textContent,10)||0}(),m=function(){var c=document.getElementById("page-counter");if(c)return counter=parseInt(c.textContent,10)||0}();return{MarkAsRead:h,MarkAsUnread:l,MarkAsRemoved:function(c){var e=b(c),f=new XMLHttpRequest;f.onload=function(){Miniflux.Nav.IsListing()&&(a(c),"unread"===c.getAttribute("data-item-status")&&g--,d())};f.open("POST","?action=mark-item-removed&id="+e,!0);f.send()},SwitchBookmark:function(c){var k=
|
||||
b(c),f="1"===c.getAttribute("data-item-bookmark")?"0":"1",n=new XMLHttpRequest;n.onload=function(){var b=document.querySelector("section.page");if(Miniflux.Nav.IsListing()&&"bookmarks"===b.getAttribute("data-item-page"))a(c),d();else if(c.setAttribute("data-item-bookmark",f),Miniflux.Nav.IsListing())b=c.querySelector("a.bookmark"),e(b);else if((b=c.querySelector("a.bookmark-icon"))&&b.hasAttribute("data-reverse-title")){var k=b.getAttribute("title");b.setAttribute("title",b.getAttribute("data-reverse-title"));
|
||||
b.setAttribute("data-reverse-title",k)}};n.open("POST","?action=bookmark&id="+k+"&value="+f,!0);n.send()},SwitchStatus:function(c){var a=c.getAttribute("data-item-status");"read"===a?l(c):"unread"===a&&h(c)},Show:function(c){(c=c.querySelector("a.show"))&&c.click()},OpenOriginal:function(c){var a=c.querySelector("a.original");a&&("unread"===c.getAttribute("data-item-status")&&h(c),a.removeAttribute("data-action"),"mouse"!==Miniflux.Event.lastEventType&&a.click())},DownloadContent:function(c){var a=
|
||||
document.getElementById("download-item");if(a){a.innerHTML=" "+a.getAttribute("data-before-message");a.className="loading-icon";var d=new XMLHttpRequest;d.onload=function(){var c=JSON.parse(d.responseText);a.className="";if(c.result){var b=document.getElementById("item-content");b&&(b.innerHTML=c.content);a.innerHTML=a.getAttribute("data-after-message")}else a.innerHTML=a.getAttribute("data-failure-message")};c=b(c);d.open("POST","?action=download-item&id="+c,!0);d.send()}},MarkListingAsRead:function(a){for(var d=
|
||||
document.getElementsByTagName("article"),e=[],g=0,h=d.length;g<h;g++)e.push(b(d[g]));d=new XMLHttpRequest;d.onload=function(){window.location.href=a};d.open("POST","?action=mark-items-as-read",!0);d.send(JSON.stringify(e))},ToggleRTLMode:function(){for(var a=["#current-item h1","#item-content","#listing #current-item h2","#listing #current-item .preview"],b=0;b<a.length;b++){var d=document.querySelector(a[b]);d&&(d.dir=""==d.dir?"rtl":"")}}}}();
|
||||
Miniflux.Event=function(){var b=[];return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(b){var a=b.target.getAttribute("data-action");a&&"original-link"!==a&&b.preventDefault()};document.onmouseup=function(b){if(2!==b.button)if("INPUT"===b.target.nodeName&&"auto-select"===b.target.className)b.target.select();else{var a=b.target.getAttribute("data-action");if(a){Miniflux.Event.lastEventType="mouse";var d;a:{for(element=b.target;element&&element.parentNode;)if(element=element.parentNode,
|
||||
element.tagName&&"article"===element.tagName.toLowerCase()){d=element;break a}d=null}switch(a){case "refresh-all":Miniflux.Feed.UpdateAll();break;case "refresh-feed":Miniflux.Feed.Update(d);break;case "mark-read":Miniflux.Item.MarkAsRead(d);break;case "mark-unread":Miniflux.Item.MarkAsUnread(d);break;case "mark-removed":Miniflux.Item.MarkAsRemoved(d);break;case "bookmark":Miniflux.Item.SwitchBookmark(d);break;case "download-item":Miniflux.Item.DownloadContent(d);break;case "original-link":Miniflux.Item.OpenOriginal(d);
|
||||
break;case "mark-all-read":Miniflux.Item.MarkListingAsRead("?action=unread");break;case "mark-feed-read":Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+b.target.getAttribute("data-feed-id"))}}}}},ListenKeyboardEvents:function(){document.onkeypress=function(e){if(63===e.keyCode||!(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)){var a=e.target||e.srcElement;if("INPUT"!==a.tagName&&"TEXTAREA"!==a.tagName)if(Miniflux.Event.lastEventType="keyboard",b.push(e.keyCode||e.which),103===b[0])switch(b[1]){case void 0:break;
|
||||
case 117:window.location.href="?action=unread";b=[];break;case 98:window.location.href="?action=bookmarks";b=[];break;case 104:window.location.href="?action=history";b=[];break;case 115:window.location.href="?action=feeds";b=[];break;case 112:window.location.href="?action=config";b=[];break;default:b=[]}else switch(b=[],a=document.getElementById("current-item"),e.keyCode||e.which){case 100:Miniflux.Item.DownloadContent(a);break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();break;case 110:case 106:Miniflux.Nav.SelectNextItem();
|
||||
break;case 118:Miniflux.Item.OpenOriginal(a);break;case 111:Miniflux.Item.Show(a);break;case 109:Miniflux.Item.SwitchStatus(a);break;case 102:Miniflux.Item.SwitchBookmark(a);break;case 104:Miniflux.Nav.OpenPreviousPage();break;case 108:Miniflux.Nav.OpenNextPage();break;case 114:Miniflux.Feed.UpdateAll();break;case 63:Miniflux.Nav.ShowHelp();break;case 122:Miniflux.Item.ToggleRTLMode()}}}}}}();
|
||||
Miniflux.Nav=function(){function d(a){var b=pageYOffset+document.documentElement.clientHeight;(0>b-(a.offsetTop+a.offsetHeight)||b-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function c(){return document.getElementById("listing")?!0:!1}return{OpenNextPage:function(){var a=document.getElementById("next-page");a&&a.click()},OpenPreviousPage:function(){var a=document.getElementById("previous-page");a&&a.click()},SelectNextItem:function(){var a=document.getElementById("next-item");
|
||||
if(a)a.click();else if(c())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var b=0,h=a.length;b<h;b++){if("current-item"===a[b].id){b+1<h&&(a[b].id="item-"+a[b].getAttribute("data-item-id"),a[b+1].id="current-item",d(a[b+1]));break}}else a[0].id="current-item",d(a[0])},SelectPreviousItem:function(){var a=document.getElementById("previous-item");if(a)a.click();else if(c())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var b=
|
||||
a.length-1;0<=b;b--){if("current-item"===a[b].id){0<=b-1&&(a[b].id="item-"+a[b].getAttribute("data-item-id"),a[b-1].id="current-item",d(a[b-1]));break}}else a[a.length-1].id="current-item",d(a[a.length-1])},ShowHelp:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},IsListing:c}}();Miniflux.App.Run();
|
||||
Miniflux.Nav=function(){function b(a){var b=pageYOffset+document.documentElement.clientHeight;(0>b-(a.offsetTop+a.offsetHeight)||b-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function e(){return document.getElementById("listing")?!0:!1}return{OpenNextPage:function(){var a=document.getElementById("next-page");a&&a.click()},OpenPreviousPage:function(){var a=document.getElementById("previous-page");a&&a.click()},SelectNextItem:function(){var a=document.getElementById("next-item");
|
||||
if(a)a.click();else if(e())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var d=0,h=a.length;d<h;d++){if("current-item"===a[d].id){d+1<h&&(a[d].id="item-"+a[d].getAttribute("data-item-id"),a[d+1].id="current-item",b(a[d+1]));break}}else a[0].id="current-item",b(a[0])},SelectPreviousItem:function(){var a=document.getElementById("previous-item");if(a)a.click();else if(e())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var d=
|
||||
a.length-1;0<=d;d--){if("current-item"===a[d].id){0<=d-1&&(a[d].id="item-"+a[d].getAttribute("data-item-id"),a[d-1].id="current-item",b(a[d-1]));break}}else a[a.length-1].id="current-item",b(a[a.length-1])},ShowHelp:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},IsListing:e}}();Miniflux.App.Run();
|
||||
|
@ -1,5 +1,23 @@
|
||||
Miniflux.Item = (function() {
|
||||
|
||||
var nbUnreadItems = function() {
|
||||
var navCounterElement = document.getElementById("nav-counter");
|
||||
|
||||
if (navCounterElement) {
|
||||
counter = parseInt(navCounterElement.textContent, 10) || 0;
|
||||
return counter;
|
||||
}
|
||||
}();
|
||||
|
||||
var nbPageItems = function() {
|
||||
var pageCounterElement = document.getElementById("page-counter");
|
||||
|
||||
if (pageCounterElement) {
|
||||
counter = parseInt(pageCounterElement.textContent, 10) || 0;
|
||||
return counter;
|
||||
}
|
||||
}();
|
||||
|
||||
function getItemID(item)
|
||||
{
|
||||
item_id = item.getAttribute("data-item-id");
|
||||
@ -40,6 +58,9 @@ Miniflux.Item = (function() {
|
||||
var link = item.querySelector("a.mark");
|
||||
if (link) link.setAttribute("data-action", "mark-unread");
|
||||
}
|
||||
|
||||
nbUnreadItems--;
|
||||
updateCounters();
|
||||
}
|
||||
|
||||
function showItemAsUnread(item)
|
||||
@ -55,6 +76,9 @@ Miniflux.Item = (function() {
|
||||
var link = item.querySelector("a.mark");
|
||||
if (link) link.setAttribute("data-action", "mark-read");
|
||||
}
|
||||
|
||||
nbUnreadItems++;
|
||||
updateCounters();
|
||||
}
|
||||
|
||||
function hideItem(item)
|
||||
@ -64,30 +88,34 @@ Miniflux.Item = (function() {
|
||||
}
|
||||
|
||||
item.parentNode.removeChild(item);
|
||||
var pageCounter = document.getElementById("page-counter");
|
||||
nbPageItems--;
|
||||
}
|
||||
|
||||
if (pageCounter) {
|
||||
var sectionElement = document.querySelector("section.page");
|
||||
var counter = parseInt(pageCounter.textContent, 10) - 1;
|
||||
var articles = document.getElementsByTagName("article");
|
||||
function updateCounters()
|
||||
{
|
||||
// imitate special handling within miniflux
|
||||
if (nbPageItems === 0) {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
if (counter === 0 || articles.length === 0) {
|
||||
window.location = location.href;
|
||||
}
|
||||
var pageCounterElement = document.getElementById("page-counter");
|
||||
pageCounterElement.textContent = nbPageItems || '';
|
||||
|
||||
var navCounterElement = document.getElementById("nav-counter");
|
||||
navCounterElement.textContent = nbUnreadItems || '';
|
||||
|
||||
pageCounter.textContent = counter;
|
||||
|
||||
switch (sectionElement.getAttribute("data-item-page")) {
|
||||
case "unread":
|
||||
document.title = "Miniflux (" + counter + ")";
|
||||
document.getElementById("nav-counter").textContent = counter;
|
||||
break;
|
||||
case "feed-items":
|
||||
document.title = "(" + counter + ") " + pageCounter.parentNode.firstChild.nodeValue;
|
||||
break;
|
||||
default:
|
||||
document.title = pageCounter.parentNode.firstChild.nodeValue + " (" + counter + ")";
|
||||
}
|
||||
// pagetitle depends on current page
|
||||
var sectionElement = document.querySelector("section.page");
|
||||
switch (sectionElement.getAttribute("data-item-page")) {
|
||||
case "unread":
|
||||
document.title = "Miniflux (" + nbUnreadItems + ")";
|
||||
break;
|
||||
case "feed-items":
|
||||
document.title = "(" + nbPageItems + ") " + pageCounterElement.parentNode.firstChild.nodeValue;
|
||||
break;
|
||||
default:
|
||||
document.title = pageCounterElement.parentNode.firstChild.nodeValue + " (" + nbPageItems + ")";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,7 +149,12 @@ Miniflux.Item = (function() {
|
||||
var request = new XMLHttpRequest();
|
||||
|
||||
request.onload = function() {
|
||||
if (Miniflux.Nav.IsListing()) hideItem(item);
|
||||
if (Miniflux.Nav.IsListing()) {
|
||||
hideItem(item);
|
||||
|
||||
if (item.getAttribute("data-item-status") === "unread") nbUnreadItems--;
|
||||
updateCounters();
|
||||
}
|
||||
};
|
||||
request.open("POST", "?action=mark-item-removed&id=" + item_id, true);
|
||||
request.send();
|
||||
@ -141,6 +174,7 @@ Miniflux.Item = (function() {
|
||||
|
||||
if (Miniflux.Nav.IsListing() && sectionElement.getAttribute("data-item-page") === "bookmarks") {
|
||||
hideItem(item);
|
||||
updateCounters();
|
||||
}
|
||||
else {
|
||||
item.setAttribute("data-item-bookmark", value);
|
||||
|
@ -55,6 +55,7 @@ Router\get_action('bookmarks', function() {
|
||||
'offset' => $offset,
|
||||
'items_per_page' => Model\Config\get('items_per_page'),
|
||||
'nothing_to_read' => Request\int_param('nothing_to_read'),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'bookmarks',
|
||||
'title' => t('Bookmarks').' ('.$nb_items.')'
|
||||
)));
|
||||
|
@ -17,6 +17,7 @@ Router\get_action('new-db', function() {
|
||||
'values' => array(
|
||||
'csrf' => Model\Config\generate_csrf(),
|
||||
),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'config',
|
||||
'title' => t('New database')
|
||||
)));
|
||||
@ -49,6 +50,7 @@ Router\post_action('new-db', function() {
|
||||
Response\html(Template\layout('new_db', array(
|
||||
'errors' => $errors,
|
||||
'values' => $values + array('csrf' => Model\Config\generate_csrf()),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'config',
|
||||
'title' => t('New database')
|
||||
)));
|
||||
@ -61,6 +63,7 @@ Router\post_action('new-db', function() {
|
||||
Router\get_action('confirm-auto-update', function() {
|
||||
|
||||
Response\html(Template\layout('confirm_auto_update', array(
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'config',
|
||||
'title' => t('Confirmation')
|
||||
)));
|
||||
@ -126,6 +129,7 @@ Router\get_action('config', function() {
|
||||
'sorting_options' => Model\Config\get_sorting_directions(),
|
||||
'display_mode' => Model\Config\get_display_mode(),
|
||||
'redirect_nothing_to_read_options' => Model\Config\get_nothing_to_read_redirections(),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'config',
|
||||
'title' => t('Preferences')
|
||||
)));
|
||||
@ -162,6 +166,7 @@ Router\post_action('config', function() {
|
||||
'sorting_options' => Model\Config\get_sorting_directions(),
|
||||
'redirect_nothing_to_read_options' => Model\Config\get_nothing_to_read_redirections(),
|
||||
'display_mode' => Model\Config\get_display_mode(),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'config',
|
||||
'title' => t('Preferences')
|
||||
)));
|
||||
@ -172,6 +177,7 @@ Router\get_action('help', function() {
|
||||
|
||||
Response\html(Template\layout('help', array(
|
||||
'config' => Model\Config\get_all(),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'config',
|
||||
'title' => t('Help')
|
||||
)));
|
||||
@ -183,6 +189,7 @@ Router\get_action('about', function() {
|
||||
Response\html(Template\layout('about', array(
|
||||
'csrf' => Model\Config\generate_csrf(),
|
||||
'config' => Model\Config\get_all(),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'config',
|
||||
'title' => t('About')
|
||||
)));
|
||||
@ -195,6 +202,7 @@ Router\get_action('database', function() {
|
||||
'csrf' => Model\Config\generate_csrf(),
|
||||
'config' => Model\Config\get_all(),
|
||||
'db_size' => filesize(\Model\Database\get_path()),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'config',
|
||||
'title' => t('Database')
|
||||
)));
|
||||
@ -205,6 +213,7 @@ Router\get_action('api', function() {
|
||||
|
||||
Response\html(Template\layout('api', array(
|
||||
'config' => Model\Config\get_all(),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'config',
|
||||
'title' => t('API')
|
||||
)));
|
||||
|
@ -19,6 +19,7 @@ Router\get_action('console', function() {
|
||||
|
||||
Response\html(Template\layout('console', array(
|
||||
'content' => @file_get_contents(DEBUG_FILENAME),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'config',
|
||||
'title' => t('Console')
|
||||
)));
|
||||
|
@ -22,6 +22,7 @@ Router\get_action('edit-feed', function() {
|
||||
Response\html(Template\layout('edit_feed', array(
|
||||
'values' => Model\Feed\get($id),
|
||||
'errors' => array(),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'feeds',
|
||||
'title' => t('Edit subscription')
|
||||
)));
|
||||
@ -48,6 +49,7 @@ Router\post_action('edit-feed', function() {
|
||||
Response\html(Template\layout('edit_feed', array(
|
||||
'values' => $values,
|
||||
'errors' => $errors,
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'feeds',
|
||||
'title' => t('Edit subscription')
|
||||
)));
|
||||
@ -60,6 +62,7 @@ Router\get_action('confirm-remove-feed', function() {
|
||||
|
||||
Response\html(Template\layout('confirm_remove_feed', array(
|
||||
'feed' => Model\Feed\get($id),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'feeds',
|
||||
'title' => t('Confirmation')
|
||||
)));
|
||||
@ -131,6 +134,7 @@ Router\get_action('feeds', function() {
|
||||
'favicons' => Model\Feed\get_all_favicons(),
|
||||
'feeds' => Model\Feed\get_all_item_counts(),
|
||||
'nothing_to_read' => Request\int_param('nothing_to_read'),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'feeds',
|
||||
'title' => t('Subscriptions')
|
||||
)));
|
||||
@ -144,6 +148,7 @@ Router\get_action('add', function() {
|
||||
'csrf' => Model\Config\generate_csrf(),
|
||||
),
|
||||
'errors' => array(),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'feeds',
|
||||
'title' => t('New subscription')
|
||||
)));
|
||||
@ -184,6 +189,7 @@ Router\action('subscribe', function() {
|
||||
'url' => $url,
|
||||
'csrf' => Model\Config\generate_csrf(),
|
||||
),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'feeds',
|
||||
'title' => t('Subscriptions')
|
||||
)));
|
||||
@ -201,6 +207,7 @@ Router\get_action('import', function() {
|
||||
|
||||
Response\html(Template\layout('import', array(
|
||||
'errors' => array(),
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'feeds',
|
||||
'title' => t('OPML Import')
|
||||
)));
|
||||
|
@ -26,6 +26,7 @@ Router\get_action('history', function() {
|
||||
'direction' => '',
|
||||
'display_mode' => Model\Config\get('items_display_mode'),
|
||||
'nb_items' => $nb_items,
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'offset' => $offset,
|
||||
'items_per_page' => Model\Config\get('items_per_page'),
|
||||
'nothing_to_read' => Request\int_param('nothing_to_read'),
|
||||
@ -38,6 +39,7 @@ Router\get_action('history', function() {
|
||||
Router\get_action('confirm-flush-history', function() {
|
||||
|
||||
Response\html(Template\layout('confirm_flush_items', array(
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'menu' => 'history',
|
||||
'title' => t('Confirmation')
|
||||
)));
|
||||
|
@ -53,7 +53,6 @@ Router\get_action('show', function() {
|
||||
switch ($menu) {
|
||||
case 'unread':
|
||||
$nav = Model\Item\get_nav($item);
|
||||
$nb_unread_items = Model\Item\count_by_status('unread');
|
||||
break;
|
||||
case 'history':
|
||||
$nav = Model\Item\get_nav($item, array('read'));
|
||||
@ -67,7 +66,7 @@ Router\get_action('show', function() {
|
||||
}
|
||||
|
||||
Response\html(Template\layout('show_item', array(
|
||||
'nb_unread_items' => isset($nb_unread_items) ? $nb_unread_items : null,
|
||||
'nb_unread_items' => $nb_unread_items = Model\Item\count_by_status('unread'),
|
||||
'item' => $item,
|
||||
'feed' => $feed,
|
||||
'item_nav' => isset($nav) ? $nav : null,
|
||||
@ -96,6 +95,7 @@ Router\get_action('feed-items', function() {
|
||||
'feed' => $feed,
|
||||
'items' => $items,
|
||||
'nb_items' => $nb_items,
|
||||
'nb_unread_items' => Model\Item\count_by_status('unread'),
|
||||
'offset' => $offset,
|
||||
'items_per_page' => Model\Config\get('items_per_page'),
|
||||
'menu' => 'feed-items',
|
||||
|
@ -23,7 +23,7 @@
|
||||
<a class="logo" href="?"><?= tne('mini<span>flux</span>') ?></a>
|
||||
<ul>
|
||||
<li <?= isset($menu) && $menu === 'unread' ? 'class="active"' : '' ?>>
|
||||
<a href="?action=unread"><?= t('unread') ?><span id="nav-counter"><?= isset($nb_unread_items) && $nb_unread_items > 0 ? $nb_unread_items : '' ?></span></a>
|
||||
<a href="?action=unread"><?= t('unread') ?><span id="nav-counter"><?= empty($nb_unread_items) ? '' : $nb_unread_items ?></span></a>
|
||||
</li>
|
||||
<li class="<?= isset($menu) && $menu === 'bookmarks' ? 'active hide-mobile' : 'hide-mobile' ?>">
|
||||
<a href="?action=bookmarks"><?= t('bookmarks') ?></a>
|
||||
|
247
tests/integration/datasets/fixture_OneUnreadArticle.xml
Normal file
247
tests/integration/datasets/fixture_OneUnreadArticle.xml
Normal file
@ -0,0 +1,247 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dataset>
|
||||
<table name="feeds">
|
||||
<column>id</column>
|
||||
<column>site_url</column>
|
||||
<column>feed_url</column>
|
||||
<column>title</column>
|
||||
<column>last_modified</column>
|
||||
<column>etag</column>
|
||||
<column>last_checked</column>
|
||||
<column>enabled</column>
|
||||
<column>download_content</column>
|
||||
<column>parsing_error</column>
|
||||
<column>rtl</column>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>http://miniflux.net/</value>
|
||||
<value>http://miniflux.net/feed.xml</value>
|
||||
<value>Recent Miniflux Releases</value>
|
||||
<null />
|
||||
<null />
|
||||
<null />
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>https://github.com/fguillot/miniflux/commits/master</value>
|
||||
<value>https://github.com/fguillot/miniflux/commits/master.atom</value>
|
||||
<value>Recent Commits to miniflux:master</value>
|
||||
<null />
|
||||
<null />
|
||||
<null />
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
</table>
|
||||
<table name="items">
|
||||
<column>id</column>
|
||||
<column>url</column>
|
||||
<column>title</column>
|
||||
<column>author</column>
|
||||
<column>content</column>
|
||||
<column>updated</column>
|
||||
<column>status</column>
|
||||
<column>feed_id</column>
|
||||
<column>bookmark</column>
|
||||
<column>enclosure</column>
|
||||
<column>enclosure_type</column>
|
||||
<column>language</column>
|
||||
<row>
|
||||
<value>22ca3b4f</value>
|
||||
<value>http://miniflux.net/news.html#2013-03-21</value>
|
||||
<value>Miniflux 1.0.2 is released</value>
|
||||
<value></value>
|
||||
<value><ul><li><a href="http://miniflux.net/miniflux-1.0.2.zip" rel="noreferrer" target="_blank" >Download archive</a></li>
|
||||
<li><a href="http://miniflux.net/changes.html#v1.0.2" rel="noreferrer" target="_blank" >ChangeLog</a></li>
|
||||
</ul></value>
|
||||
<value>##TIMESTAMP##92</value>
|
||||
<value>read</value>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>30d227f3</value>
|
||||
<value>http://miniflux.net/news.html#2013-07-22</value>
|
||||
<value>Miniflux 1.0.10 is released!</value>
|
||||
<value></value>
|
||||
<value><ul><li><a href="http://miniflux.net/miniflux-1.0.10.zip" rel="noreferrer" target="_blank" >Download archive</a></li>
|
||||
<li><a href="http://miniflux.net/changes.html#v1.0.10" rel="noreferrer" target="_blank" >ChangeLog</a></li>
|
||||
</ul></value>
|
||||
<value>##TIMESTAMP##97</value>
|
||||
<value>read</value>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>4b2dbd17</value>
|
||||
<value>http://miniflux.net/news.html#2013-03-26</value>
|
||||
<value>Miniflux 1.0.3 is released</value>
|
||||
<value></value>
|
||||
<value><ul><li><a href="http://miniflux.net/miniflux-1.0.3.zip" rel="noreferrer" target="_blank" >Download archive</a></li>
|
||||
<li><a href="http://miniflux.net/changes.html#v1.0.3" rel="noreferrer" target="_blank" >ChangeLog</a></li>
|
||||
</ul></value>
|
||||
<value>##TIMESTAMP##93</value>
|
||||
<value>read</value>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>51b4239b</value>
|
||||
<value>http://miniflux.net/news.html#2013-04-12</value>
|
||||
<value>Miniflux 1.0.6 is released</value>
|
||||
<value></value>
|
||||
<value><ul><li><a href="http://miniflux.net/miniflux-1.0.6.zip" rel="noreferrer" target="_blank" >Download archive</a></li>
|
||||
<li><a href="http://miniflux.net/changes.html#v1.0.6" rel="noreferrer" target="_blank" >ChangeLog</a></li>
|
||||
</ul></value>
|
||||
<value>##TIMESTAMP##94</value>
|
||||
<value>read</value>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>7c6afaa5</value>
|
||||
<value>http://miniflux.net/news.html#2014-01-02</value>
|
||||
<value>Miniflux 1.1.1 is released</value>
|
||||
<value></value>
|
||||
<value><ul><li><a href="http://miniflux.net/miniflux-1.1.1.zip" rel="noreferrer" target="_blank" >Download archive</a></li>
|
||||
<li><a href="http://miniflux.net/changes.html#v1.1.1" rel="noreferrer" target="_blank" >ChangeLog</a></li>
|
||||
</ul><p>Major improvements:</p>
|
||||
<ul><li>New theme: Copper (By the contributor Nicolas Dewaele)</li>
|
||||
<li>Display a message next to a feed when there is a parsing error</li>
|
||||
<li>Change default value of autoflush to 15 days if not set to avoid large database</li>
|
||||
<li>Add autoflush value &quot;immediately&quot;</li>
|
||||
<li>Add an option to choose where to be redirected when there is nothing to read</li>
|
||||
<li>Bug fixes</li>
|
||||
</ul></value>
|
||||
<value>##TIMESTAMP##99</value>
|
||||
<value>read</value>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>7cb2809d</value>
|
||||
<value>http://miniflux.net/news.html#2013-09-02</value>
|
||||
<value>Miniflux 1.0.11 is released</value>
|
||||
<value></value>
|
||||
<value><ul><li><a href="http://miniflux.net/miniflux-1.0.11.zip" rel="noreferrer" target="_blank" >Download archive</a></li>
|
||||
<li><a href="http://miniflux.net/changes.html#v1.0.11" rel="noreferrer" target="_blank" >ChangeLog</a></li>
|
||||
</ul></value>
|
||||
<value>##TIMESTAMP##98</value>
|
||||
<value>unread</value>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>9b20eb66</value>
|
||||
<value>http://miniflux.net/news.html#2013-04-30</value>
|
||||
<value>Miniflux 1.0.7 is released</value>
|
||||
<value></value>
|
||||
<value><ul><li><a href="http://miniflux.net/miniflux-1.0.7.zip" rel="noreferrer" target="_blank" >Download archive</a></li>
|
||||
<li><a href="http://miniflux.net/changes.html#v1.0.7" rel="noreferrer" target="_blank" >ChangeLog</a></li>
|
||||
</ul></value>
|
||||
<value>##TIMESTAMP##95</value>
|
||||
<value>read</value>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>9fa78b54</value>
|
||||
<value>http://miniflux.net/news.html#2013-06-02</value>
|
||||
<value>Miniflux 1.0.8 is released</value>
|
||||
<value></value>
|
||||
<value><ul><li><a href="http://miniflux.net/miniflux-1.0.8.zip" rel="noreferrer" target="_blank" >Download archive</a></li>
|
||||
<li><a href="http://miniflux.net/changes.htm#v1.0.8" rel="noreferrer" target="_blank" >ChangeLog</a></li>
|
||||
</ul></value>
|
||||
<value>##TIMESTAMP##96</value>
|
||||
<value>read</value>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>1f4670bf</value>
|
||||
<value>https://github.com/fguillot/miniflux/commit/e1b22f2d3592d653d4c22ce5f137bb1e0ae5dd3f</value>
|
||||
<value>Redirect to the feed page after adding a subscription</value>
|
||||
<value>fguillot</value>
|
||||
<value><pre>Redirect to the feed page after adding a subscription</pre></value>
|
||||
<value>##TIMESTAMP##89</value>
|
||||
<value>read</value>
|
||||
<value>2</value>
|
||||
<value>0</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>2063e830</value>
|
||||
<value>https://github.com/fguillot/miniflux/commit/e732e80deed05ea46667957835b2499bb895ebe9</value>
|
||||
<value>Update the Json-RPC library and improve make-archive.sh</value>
|
||||
<value>fguillot</value>
|
||||
<value><pre>Update the Json-RPC library and improve make-archive.sh</pre></value>
|
||||
<value>##TIMESTAMP##88</value>
|
||||
<value>read</value>
|
||||
<value>2</value>
|
||||
<value>0</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>208ee9dd</value>
|
||||
<value>https://github.com/fguillot/miniflux/commit/871f1d1d6410403599c774ad9aa20e55c77162fc</value>
|
||||
<value>Update PicoDb and improve schema migration error handling</value>
|
||||
<value>fguillot</value>
|
||||
<value><pre>Update PicoDb and improve schema migration error handling</pre></value>
|
||||
<value>##TIMESTAMP##87</value>
|
||||
<value>read</value>
|
||||
<value>2</value>
|
||||
<value>1</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>3530d7cd</value>
|
||||
<value>https://github.com/fguillot/miniflux/commit/d7e5cd0ad424859912fc209651494fad5c52cd34</value>
|
||||
<value>New theme: 'Hello' created by Meradoou</value>
|
||||
<value>fguillot</value>
|
||||
<value><pre>New theme: &#039;Hello&#039; created by Meradoou</pre></value>
|
||||
<value>##TIMESTAMP##86</value>
|
||||
<value>read</value>
|
||||
<value>2</value>
|
||||
<value>1</value>
|
||||
<value></value>
|
||||
<value></value>
|
||||
<value>en-US</value>
|
||||
</row>
|
||||
</table>
|
||||
</dataset>
|
@ -5,6 +5,7 @@ require_once 'minifluxTestCase.php';
|
||||
class keyboardShortcutTest extends minifluxTestCase
|
||||
{
|
||||
const DEFAULT_COUNTER_PAGE = 8;
|
||||
const DEFAULT_COUNTER_UNREAD = 6;
|
||||
|
||||
public function setUpPage()
|
||||
{
|
||||
@ -34,6 +35,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
$this->assertTrue($secondIsCurrentArticle, 'The second Article is not the current Article');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
}
|
||||
|
||||
@ -51,6 +53,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
$this->assertTrue($secondIsCurrentArticle, 'The second Article is not the current Article');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');;
|
||||
}
|
||||
|
||||
@ -68,6 +71,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
$this->assertTrue($secondIsNotCurrentArticle, 'The second Article is still the current Article');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
}
|
||||
|
||||
@ -85,6 +89,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
$this->assertTrue($secondIsNotCurrentArticle, 'The second Article is still the current Article');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
}
|
||||
|
||||
@ -103,6 +108,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
$this->assertTrue($lastIsCurrentArticle, 'The last Article is not the current Article');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
}
|
||||
|
||||
@ -121,6 +127,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
$this->assertTrue($firstIsCurrentArticle, 'The first Article is not the current Article');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
}
|
||||
|
||||
@ -131,6 +138,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
$this->url($url);
|
||||
$this->byId('form-username')->value($this->getShortcutGoToUnread());
|
||||
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedPageUrl = $url;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
|
||||
@ -142,6 +150,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
$this->sendKeysAndWaitForPageLoaded('gb');
|
||||
|
||||
$this->expectedCounterPage = '6';
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedPageUrl = $this->getURLPageBookmarks();
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
|
||||
@ -153,6 +162,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
$this->sendKeysAndWaitForPageLoaded('gh');
|
||||
|
||||
$this->expectedCounterPage = '6';
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedPageUrl = $this->getURLPageHistory();
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
|
||||
@ -164,7 +174,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
$this->sendKeysAndWaitForPageLoaded($this->getShortcutGoToUnread());
|
||||
|
||||
$this->expectedCounterPage = '6';
|
||||
$this->expectedCounterUnread = '6';
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedPageUrl = $this->getURLPageUnread();
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
|
||||
@ -175,6 +185,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
{
|
||||
$this->sendKeysAndWaitForPageLoaded('gs');
|
||||
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds';
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
|
||||
@ -185,6 +196,7 @@ class keyboardShortcutTest extends minifluxTestCase
|
||||
{
|
||||
$this->sendKeysAndWaitForPageLoaded('gp');
|
||||
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedPageUrl = $this->getURLPagePreferences();
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
|
||||
|
@ -5,6 +5,7 @@ require_once 'minifluxTestCase.php';
|
||||
class pageBookmarksTest extends minifluxTestCase
|
||||
{
|
||||
const DEFAULT_COUNTER_PAGE = 6;
|
||||
const DEFAULT_COUNTER_UNREAD = 6;
|
||||
|
||||
public function setUpPage()
|
||||
{
|
||||
@ -26,6 +27,7 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertNotEmpty($articles, 'no articles from other feeds found');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
}
|
||||
|
||||
@ -35,6 +37,7 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertEmpty($articles, 'found not bookmarked articles.');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
}
|
||||
|
||||
@ -49,6 +52,7 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'read icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -63,6 +67,7 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'read icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -77,6 +82,7 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'read icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -91,6 +97,7 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'read icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -105,6 +112,7 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
|
||||
|
||||
}
|
||||
@ -120,6 +128,7 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
|
||||
}
|
||||
|
||||
@ -134,6 +143,7 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
|
||||
}
|
||||
|
||||
@ -148,6 +158,7 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
|
||||
}
|
||||
|
||||
@ -162,6 +173,7 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -176,9 +188,59 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle');
|
||||
}
|
||||
|
||||
public function testUnreadCounterFromNothingToValue()
|
||||
{
|
||||
// load different fixture and reload the page
|
||||
$backupDataTester = static::$databaseTester;
|
||||
|
||||
static::$databaseTester = NULL;
|
||||
$this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp();
|
||||
|
||||
static::$databaseTester = $backupDataTester;
|
||||
$this->refresh();
|
||||
|
||||
// start the "real" test
|
||||
// dont't trust the name! The Article is read+bookmarked here
|
||||
$article = $this->getArticleUnreadBookmarked();
|
||||
|
||||
$link = $this->getLinkReadStatusToogle($article);
|
||||
$link->click();
|
||||
|
||||
$this->waitForIconMarkReadInvisible($article);
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = 1;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE);
|
||||
}
|
||||
|
||||
public function testUnreadCounterFromValueToNothing()
|
||||
{
|
||||
// load different fixture and reload the page
|
||||
$backupDataTester = static::$databaseTester;
|
||||
|
||||
static::$databaseTester = NULL;
|
||||
$this->getDatabaseTester('fixture_OneUnreadArticle', FALSE)->onSetUp();
|
||||
|
||||
static::$databaseTester = $backupDataTester;
|
||||
$this->refresh();
|
||||
|
||||
// start the "real" test
|
||||
$article = $this->getArticleUnreadBookmarked();
|
||||
|
||||
$link = $this->getLinkReadStatusToogle($article);
|
||||
$link->click();
|
||||
|
||||
$this->waitForIconMarkReadVisible($article);
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = '';
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles',FALSE);
|
||||
}
|
||||
|
||||
public function testRedirectWithZeroArticles()
|
||||
{
|
||||
$articles = $this->getArticles();
|
||||
@ -193,6 +255,8 @@ class pageBookmarksTest extends minifluxTestCase
|
||||
$visible = $this->waitForAlert();
|
||||
$this->assertTrue($visible, 'alert box did not appear');
|
||||
|
||||
$this->expectedCounterPage = NULL;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_NoBookmarkedArticles', FALSE);
|
||||
|
||||
$this->ignorePageTitle = TRUE;
|
||||
|
@ -5,6 +5,7 @@ require_once 'minifluxTestCase.php';
|
||||
class pageFirstFeedTest extends minifluxTestCase
|
||||
{
|
||||
const DEFAULT_COUNTER_PAGE = 8;
|
||||
const DEFAULT_COUNTER_UNREAD = 6;
|
||||
|
||||
public function setUpPage()
|
||||
{
|
||||
@ -26,6 +27,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertEmpty($articles, 'found articles from other feeds on page for first feed.');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
}
|
||||
|
||||
@ -40,6 +42,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'read icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -54,6 +57,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'read icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -68,6 +72,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'read icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -82,6 +87,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'read icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -96,6 +102,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'read icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -110,6 +117,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'read icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -124,6 +132,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'read icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -138,6 +147,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'read icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -152,6 +162,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'bookmark icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle');
|
||||
}
|
||||
|
||||
@ -166,6 +177,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'bookmark icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle');
|
||||
}
|
||||
|
||||
@ -180,6 +192,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'bookmark icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle');
|
||||
}
|
||||
|
||||
@ -194,6 +207,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'bookmark icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle');
|
||||
}
|
||||
|
||||
@ -208,6 +222,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
|
||||
}
|
||||
|
||||
@ -222,6 +237,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
|
||||
}
|
||||
|
||||
@ -236,6 +252,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
|
||||
}
|
||||
|
||||
@ -250,6 +267,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
|
||||
}
|
||||
|
||||
@ -264,6 +282,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadNotBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -278,6 +297,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -292,6 +312,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadNotBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -306,6 +327,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -318,6 +340,7 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($read, 'there are still unread articles');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = 2;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkFeedRead');
|
||||
}
|
||||
|
||||
@ -330,9 +353,59 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$this->assertTrue($read, 'there are still unread articles');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = 2;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkFeedRead');
|
||||
}
|
||||
|
||||
public function testUnreadCounterFromNothingToValue()
|
||||
{
|
||||
// load different fixture and reload the page
|
||||
$backupDataTester = static::$databaseTester;
|
||||
|
||||
static::$databaseTester = NULL;
|
||||
$this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp();
|
||||
|
||||
static::$databaseTester = $backupDataTester;
|
||||
$this->refresh();
|
||||
|
||||
// start the "real" test
|
||||
// dont't trust the name! The Article is read+bookmarked here
|
||||
$article = $this->getArticleUnreadBookmarked();
|
||||
|
||||
$link = $this->getLinkReadStatusToogle($article);
|
||||
$link->click();
|
||||
|
||||
$this->waitForIconMarkReadInvisible($article);
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = 1;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE);
|
||||
}
|
||||
|
||||
public function testUnreadCounterFromValueToNothing()
|
||||
{
|
||||
// load different fixture and reload the page
|
||||
$backupDataTester = static::$databaseTester;
|
||||
|
||||
static::$databaseTester = NULL;
|
||||
$this->getDatabaseTester('fixture_OneUnreadArticle', FALSE)->onSetUp();
|
||||
|
||||
static::$databaseTester = $backupDataTester;
|
||||
$this->refresh();
|
||||
|
||||
// start the "real" test
|
||||
$article = $this->getArticleUnreadBookmarked();
|
||||
|
||||
$link = $this->getLinkReadStatusToogle($article);
|
||||
$link->click();
|
||||
|
||||
$this->waitForIconMarkReadVisible($article);
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = '';
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles',FALSE);
|
||||
}
|
||||
|
||||
public function testRedirectWithZeroArticles()
|
||||
{
|
||||
$articles = $this->getArticles();
|
||||
@ -348,6 +421,8 @@ class pageFirstFeedTest extends minifluxTestCase
|
||||
$visible = $this->waitForAlert();
|
||||
$this->assertTrue($visible, 'alert box did not appear');
|
||||
|
||||
$this->expectedCounterPage = NULL;
|
||||
$this->expectedCounterUnread = 2;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_FirstFeedAllRemoved');
|
||||
|
||||
$this->ignorePageTitle = TRUE;
|
||||
|
@ -5,6 +5,7 @@ require_once 'minifluxTestCase.php';
|
||||
class pageHistoryTest extends minifluxTestCase
|
||||
{
|
||||
const DEFAULT_COUNTER_PAGE = 6;
|
||||
const DEFAULT_COUNTER_UNREAD = 6;
|
||||
|
||||
public function setUpPage()
|
||||
{
|
||||
@ -26,6 +27,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertNotEmpty($articles, 'no articles from other feeds found');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
}
|
||||
|
||||
@ -35,6 +37,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertEmpty($articles, 'found unread articles.');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
|
||||
}
|
||||
|
||||
@ -49,6 +52,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -63,6 +67,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -77,6 +82,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -91,6 +97,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -105,6 +112,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'bookmark icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle');
|
||||
}
|
||||
|
||||
@ -119,6 +127,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertTrue($visible, 'bookmark icon is not visible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle');
|
||||
}
|
||||
|
||||
@ -133,6 +142,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
|
||||
}
|
||||
|
||||
@ -147,6 +157,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'bookmark icon is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
|
||||
}
|
||||
|
||||
@ -161,6 +172,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadNotBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -175,6 +187,7 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$this->assertTrue($invisible, 'article is is not invisible');
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadBookmarkedArticle');
|
||||
}
|
||||
|
||||
@ -187,11 +200,37 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$destructiveLink->click();
|
||||
|
||||
$this->expectedCounterPage = 3;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_NoReadNotBookmarkedArticles', FALSE);
|
||||
|
||||
$this->ignorePageTitle = TRUE;
|
||||
}
|
||||
|
||||
public function testUnreadCounterFromNothingToValue()
|
||||
{
|
||||
// load different fixture and reload the page
|
||||
$backupDataTester = static::$databaseTester;
|
||||
|
||||
static::$databaseTester = NULL;
|
||||
$this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp();
|
||||
|
||||
static::$databaseTester = $backupDataTester;
|
||||
$this->refresh();
|
||||
|
||||
// start the "real" test
|
||||
// dont't trust the name! The Article is read+bookmarked here
|
||||
$article = $this->getArticleUnreadBookmarked();
|
||||
|
||||
$link = $this->getLinkReadStatusToogle($article);
|
||||
$link->click();
|
||||
|
||||
$this->waitForIconMarkReadInvisible($article);
|
||||
|
||||
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE + static::DEFAULT_COUNTER_UNREAD - 1;
|
||||
$this->expectedCounterUnread = 1;
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE);
|
||||
}
|
||||
|
||||
public function testRedirectWithZeroArticles()
|
||||
{
|
||||
$articles = $this->getArticles();
|
||||
@ -207,6 +246,8 @@ class pageHistoryTest extends minifluxTestCase
|
||||
$visible = $this->waitForAlert();
|
||||
$this->assertTrue($visible, 'alert box did not appear');
|
||||
|
||||
$this->expectedCounterPage = NULL;
|
||||
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + static::DEFAULT_COUNTER_PAGE;
|
||||
$this->expectedDataSet = $this->getDataSet('expected_NoReadArticles', FALSE);
|
||||
|
||||
$this->ignorePageTitle = TRUE;
|
||||
|
@ -199,6 +199,7 @@ class pageUnreadTest extends minifluxTestCase
|
||||
$read = $this->waitForArticlesMarkRead();
|
||||
$this->assertTrue($read, 'there are still unread articles');
|
||||
|
||||
$this->expectedCounterPage = NULL;
|
||||
$this->expectedCounterUnread = '';
|
||||
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds¬hing_to_read=1';
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles', FALSE);
|
||||
@ -214,6 +215,7 @@ class pageUnreadTest extends minifluxTestCase
|
||||
$read = $this->waitForArticlesMarkRead();
|
||||
$this->assertTrue($read, 'there are still unread articles');
|
||||
|
||||
$this->expectedCounterPage = NULL;
|
||||
$this->expectedCounterUnread = '';
|
||||
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds¬hing_to_read=1';
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles', FALSE);
|
||||
@ -236,6 +238,7 @@ class pageUnreadTest extends minifluxTestCase
|
||||
$visible = $this->waitForAlert();
|
||||
$this->assertTrue($visible, 'alert box did not appear');
|
||||
|
||||
$this->expectedCounterPage = NULL;
|
||||
$this->expectedCounterUnread = '';
|
||||
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds¬hing_to_read=1';
|
||||
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles', FALSE);
|
||||
|
Loading…
Reference in New Issue
Block a user