aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/tooltip/tooltip_methods.js35
-rw-r--r--ui/jquery.ui.tooltip.js8
2 files changed, 41 insertions, 2 deletions
diff --git a/tests/unit/tooltip/tooltip_methods.js b/tests/unit/tooltip/tooltip_methods.js
index a557ff943..ead360bf3 100644
--- a/tests/unit/tooltip/tooltip_methods.js
+++ b/tests/unit/tooltip/tooltip_methods.js
@@ -96,4 +96,39 @@ test( "widget", function() {
strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" );
});
+test( "preserve changes to title attributes on close and destroy", function() {
+ expect( 6 );
+ var element = $( "#tooltipped1" ),
+ changed = "changed title text",
+ original = "original title text",
+ tests = [];
+
+ // 1. Changes to title attribute are preserved on close()
+ tests[ 0 ] = { title: changed, expected: changed, method: "close" };
+ // 2. Changes to title attribute are preserved on destroy()
+ tests[ 1 ] = { title: changed, expected: changed , method: "destroy" };
+ // 3. Changes to title attribute are NOT preserved when set to empty string on close()
+ tests[ 2 ] = { title: "", expected: original, method: "close" };
+ // 4. Changes to title attribute are NOT preserved when set to empty string on destroy()
+ tests[ 3 ] = { title: "", expected: original, method: "destroy" };
+ // 5. Changes to title attribute NOT preserved when attribute has been removed on close()
+ tests[ 4 ] = { expected: original, method: "close" };
+ // 6. Changes to title attribute NOT preserved when attribute has been removed on destroy()
+ tests[ 5 ] = { expected: original, method: "destroy" };
+
+ $.each( tests, function( index, test ) {
+
+ element.attr( "title", original ).tooltip()
+ .tooltip( "open", $.Event( "mouseover", { target: element[ 0 ] } ) );
+ if ( test.title ) {
+ element.attr( "title", test.title );
+ } else {
+ element.removeAttr( "title" );
+ }
+ element.tooltip( test.method );
+ equal( $( "#tooltipped1" ).attr( "title" ), test.expected );
+
+ } );
+});
+
}( jQuery ) );
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index 1ebe1a958..6854032f4 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -339,7 +339,8 @@ $.widget( "ui.tooltip", {
clearInterval( this.delayedShow );
// only set title if we had one before (see comment in _open())
- if ( target.data( "ui-tooltip-title" ) ) {
+ // If the title attribute has changed since open(), don't restore
+ if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
target.attr( "title", target.data( "ui-tooltip-title" ) );
}
@@ -412,7 +413,10 @@ $.widget( "ui.tooltip", {
// Restore the title
if ( element.data( "ui-tooltip-title" ) ) {
- element.attr( "title", element.data( "ui-tooltip-title" ) );
+ // If the title attribute has changed since open(), don't restore
+ if ( !element.attr( "title" ) ) {
+ element.attr( "title", element.data( "ui-tooltip-title" ) );
+ }
element.removeData( "ui-tooltip-title" );
}
});
rt-bundle Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Share_Backend_File_Dependent.php
blob: a7f866dd7d0a5d2c995e64caaae5e74fafa5702b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
 * @copyright Copyright (c) 2016, ownCloud, Inc.
 *
 * @author Joas Schilling <coding@schilljs.com>
 * @author Morris Jobke <hey@morrisjobke.de>
 *
 * @license AGPL-3.0
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */

// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;

/**
 * Interface for share backends that share content that is dependent on files.
 * Extends the Share_Backend interface.
 * @since 5.0.0
 */
interface Share_Backend_File_Dependent extends Share_Backend {
	/**
	 * Get the file path of the item
	 * @param string $itemSource
	 * @param string $uidOwner User that is the owner of shared item
	 * @return string|false
	 * @since 5.0.0
	 */
	public function getFilePath($itemSource, $uidOwner);

}